STEP 09 combining SCRIPTS

Now let's open up the Script object again and look at the other scripts. The Rollover script and Rollout script have been made into "generic" scripts. They can be called by every Navigation button, yet will do different things for each. Simply set a few variables that affect the Rollout or Rollover script, and they change the behavior of the script. The reason one does this becomes apparent in large projects that can change during the development process. Suppose a client wants all the buttons to show a logo on the screen on rollover. Instead of going through every button script in the project, you can simply change one line in one script. In huge projects this can save hours.

creating the generic rollover action

You need to plan carefully to get the most out of object-oriented programming. Typically, you'll have one or more general routines that are maintained in the scripts object. Each of these series of actions must be designed so that it can accept variables from other objects. The variables are, in essence, the details of the general routine. By changing the routine's variables before you call a routine, you can change how that general routine behaves.

In the ManiFestival movie, for example, there are two general routines: RolloverScript and RolloutScript. The RolloverScript performs three general actions (plays the Dancer movie, moves a line of simulated time-code, and floats the name of the festival across the screen) whereas the RolloutScript invokes two actions (plays the dancer movie again and plays a second movie). The particulars of these actions ”what portion of the Dancer movie is played , where the time-code moves from and to, and which second movie plays ”are set by the variables passed to the general routines when they are called from each separate button.

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 © 2008-2017.
If you may any questions please contact us: