3.
Select Control > Test Movie to test the document.
The image loads into the
handlers let you drag the image around the Stage.
Broadcasting events from component
instances
For any component instance, you can specify how an event is handled. Component events are
handled differently than events broadcast from native ActionScript objects.
For more information, see "Handling Component Events" in Using Components.
Creating movie clips with button states
When you attach an
MovieClip mouse event handlers for a movie clip instance, the movie clip responds to mouse
events in the same way as a button. You can also create automatic button states (Up, Over,
and Down) in a movie clip by adding the frame labels
clip's timeline.
When the user moves the mouse over the movie clip or clicks it, the playhead is sent to the
frame with the appropriate frame label. To designate the hit area that a movie clip uses, you
use the hitArea (MovieClip.hitArea property) property.
To create button states in a movie clip:
1.
Create a new Flash document and save it as mcbutton.fla.
2.
Using the Rectangle Tool, draw a small rectangle (approximately 100 pixels wide by 20
pixels high) on the Stage.
3.
Double-click the shape with the Selection tool and press F8 to launch the Convert to
Symbol dialog box.
4.
Enter a symbol name of mcbutton, set the symbol type to movie clip, and click OK.
5.
Double-click the movie clip symbol on the Stage to enter symbol-editing mode.
6.
Create a new layer in the movie clip's timeline and rename the new layer labels.
7.
Enter a frame label of
8.
Create a new layer above the default layer and labels layer.
342
Handling Events
instance, and the
img_mc
handler to a movie clip, or assign a function to one of the
on()
in the Property inspector.
_up
and
onPress()
onRelease()
,
, and
_up
_over
_down
event
to the movie
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?