This content has been marked as final. Show 2 replies
the 2nd code works perfectly well and has significant advantages over the code you're attaching directly to your button/movieclip. you just need to use something meaningful instead of "not_set_yet" which was chosen to prompt you to realize you still needed to do something.
kglad nailed it:
> the 2nd code works perfectly well and has significant advantages
> over the code you're attaching directly to your button/movieclip.
The on() and onClipEvent() approaches require direct attachment of code,
in which case the intended recipient of your instructions is obvious. If
you're using the dot notation approach, code goes into a keyframe instead,
so Flash needs a way to know which object you're talking about. That
"not_set_yet" reference, as kglad pointed out, means that you haven't yet
associated the event handler -- here, onRelease -- with an object, such as a
button or movie clip. To make that association, you need to give your
object a unique instance name. One way to do that is to select the object
and look at the Property inspector. You'll see the instance name input
field in the upper left corner.
Here are a few additional notes on making this switch, which, just so
you know, becomes required in ActionScript 3.0.
Co-author, Foundation Flash CS3 for Designers
"Luck is the residue of good design."