STEP 12 rolloverscript: controlling the DANCER MOVIE CLIP


The next portion of the RolloverScript affects the movie clip of the spinning dancer. The movie clip object is called /dancer, after the name of the performer. For this movie clip, two elements are important: the transparency and the portion of the clip being played . The movie clip is made more opaque when it plays and less opaque when it stops; the Alpha property handles transparency.

Because I want different buttons to play different portions of the movie clip, a variable is used in combination with the Go and Play action. This variable, dancer_framelabel, is set in each of the buttons . I also want to be sure that the first time the movie clip plays, it starts from the beginning. To base an action on a current property of an object, you use what is referred to, in programming jargon, as a conditional statement. One such conditional statement in Flash is the If-Else-End-If series: If my condition is met, do this action; else, do that one.

Follow these steps to reconstruct the Dancer Control in the RolloverScript:

  1. If necessary, double-click the RolloverScript keyframe to enter the Actions panel of the Frame Properties dialog.

  2. With the last code line selected, choose Set Property from the Add Actions list (see figure 08:25).


    Figure 08:25.

    graphics/08fig25.jpg


  3. Choose the Alpha property from the Set list and enter /dancer as the Target and 66 as the Value.

    Now, when any rollover is initiated, the /dancer movie clip becomes more opaque without overtaking the screen. You want the Dancer object to have this transparency for every rollover. That is why you set this property to a value rather than a variable.

  4. From the Add Action list, select Tell Target and enter /dancer into the Target field.

    You've identified the target, so it's time to begin to enter the conditional statement. You want to create a statement that acts one way if the current frame is larger than 10 (meaning the movie is underway) and another way if it's not.

  5. Choose If from the Add Action list, select the option button with the equal sign, and select Expression Editor from the list.



Flash Web Design The Art Of Motion Graphics
Flash Web Design oder: the art of motion graphics
ISBN: 3827256623
EAN: 2147483647
Year: 2005
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net