| Flash 5: ScriptClips & SmartClips |
September
07, 2001
|
|||||||
|
||||||||
|
Building
the ScriptClip
What
does this do?
In other words we take the current alpha value of the parent Movie Clip and add 5 to the current value. The += operator automatically takes into account the current value of the alpha property and adds the specified number to it, in this case 5. Thus this statement:
Both are
valid. One if more efficient and "cleaner" if you like.
You have
to keep in mind how the scrub (or Playhead) works in Flash. The scrub
travels over each frame displaying the contents appropriately or executing
scripts placed in key frames or on Instances. In this case, the scrub
would pass through Frame 1 and execute the script to increment the alpha
value. If we had only one key frame with the script to increment the alpha
value within it, the script would only execute once, incrementing the
current alpha property of the parent Instance by 5. Because we want the
script to continually increment the alpha property we need to create a
loop whereby the scrub, having executed the script in key frame 1 at frame
1, moves to key frame 2 at frame 2 and is told to return to the key frame
at frame 1, thereby continually executing the script in key frame 1 and
continually incrementing the alpha property. |
|
|
||||||||
|