swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] In general need of guidance


From: Randall Hand
Subject: [Swftools-common] In general need of guidance
Date: Tue, 29 May 2007 09:46:23 -0500

Ok, I've about given up.  I've been a programmer for over 10 years, but I just can't get the hang of this :)  I just need some general guidance in what I should be doing.  Code would be fantastic, but any guidance in appreciated.

I've been tasked with developing a flash widget like the one at www.steampowered.com.  I need to read configuration options from _javascript_ or an XML file at Run-Time (like the SteamPowered widget) that contain a list of Images, Descriptive Text, and a URL.  Then the widget should automatically flip between the images every few seconds (adjusting the button highlight & descriptive text to match) and stop animating if the user clicks a button, jumping directly to that image.  Clicking on the image loads the selected URL.

What I have you can see at http://www.yeraze.com/swf .  I have ALOT of questions:

1) How do I load an image into a "box".  Every variation of loadMovie i've tried seems to load the image just fine, but refuses to animate and seems to just blow away my entire widget.
2) Changing Text - Someone in freenode's #flash showed me how to manually construct a "textBox" and get the text to change, but I can't get the text formatted properly.  I need to change the font and size of the text, but it doesn't seem to work.
3) I've seen examples on how to make the buttons do things with the ".on_press:" tags, but how can I change them without user interaction? eg. the scrolling through of the buttons.
4) Just in general, how do you do this?  Is it possible with SWFc? 

The code i'm using right now is this:

flash fps=50 bbox=457x172 compress

.box img1 width=457 height=172 fill=red
.box img2 width=457 height=172 fill=blue
.box img3 width=457 height=172 fill=green
.box img4 width=457 height=172 fill=cyan
.box img5 width=457 height=172 fill=yellow
.font Hanzei "Hanzei.swf"
.box bg width=457 height=40 color=white fill=white
.box boxNorm color=white fill=#bbbbbb width=30 height=20
.box boxOver color=white fill=#dddddd width=30 height=20
.box boxDown color=white fill=#ffffff width=30 height=20

.sprite transition
    .action:
        myDesc = ["DSC00140", "DSC00141", "DSC00142", "DSC00143", "DSC00144"];
        counter = -1;
        function setDescription()
        {
            id = counter % 5;
            _root.textBox.text = myDesc[id];
        }
    .end
    .frame 1
        .put img1 alpha=100%
        .put img2 alpha=0%
        .put img3 alpha=0%
        .put img4 alpha=0%
        .put img5 alpha=0%
        .action:
            counter++;
            setDescription();
        .end
    .frame 90
        .change img1 alpha=100%
        .change img2 alpha=0%
    .frame 120
        .change img1 alpha=0%
        .change img2 alpha=100%
        .action:
            counter++;
            setDescription();
        .end

    .frame 210
        .change img2 alpha=100%
        .change img3 alpha=0%
    .frame 240
        .change img2 alpha=0%
        .change img3 alpha=100%
        .action:
            counter++;
            setDescription();
        .end

    .frame 330
        .change img3 alpha=100%
        .change img4 alpha=0%
    .frame 360
        .change img3 alpha=0%
        .change img4 alpha=100%
        .action:
            counter++;
            setDescription();
        .end

    .frame 450
        .change img4 alpha=100%
        .change img5 alpha=0%
    .frame 480
        .change img4 alpha=0%
        .change img5 alpha=100%
        .action:
            counter++;
            setDescription();
        .end

    .frame 570
        .change img5 alpha=100%
        .change img1 alpha=0%
    .frame 600
        .change img5 alpha=0%
        .change img1 alpha=100%

.end

.button mybutton
    .show boxNorm as=idle
    .show boxOver as=hover
    .show boxDown as=pressed
.end
.sprite toolbar
    .frame 1
        .put bg y=132 x=0 alpha=80%
        .put b1=mybutton x=10 y=142
        .put b2=mybutton x=50 y=142
        .put b3=mybutton x=90 y=142
        .put b4=mybutton x=130 y=142
        .put b5=mybutton x=170 y=142
.end

.put transition
.put toolbar


.action:
  _root.createEmptyMovieClip("movie", 100);
  _root.attachMovie("transition", "movie", 100);

  _root.createEmptyMovieClip("tool", 200);
  _root.attachMovie("toolbar", "tool",  200);

  var tm = new TextureManager("img/");
  _root.createTextField("textBox", 3400, 240,140,100,50);
  fmt = new TextFormat();
  fmt.color = 0xFFFFFF;
  fmt.font = "Arial";
  fmt.size = 36;
  _root.textBox.setTextFormat(fmt);

.end

.end


--
----------------------------------------
Randall Hand
Visualization Scientist
ERDC MSRC-ITL
reply via email to

[Prev in Thread] Current Thread [Next in Thread]