Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Handling Events > Using button and movie clip event handlers | |||
You can attach event handlers directly to a button or movie clip instance on the Stage by using the onClipEvent() and on() event handlers. The onClipEvent() event handler broadcasts movie clip events, and the on() event handler handles button events.
To attach an event handler to a button or movie clip instance, click the button or movie clip instance on the Stage to bring it in focus, and then enter code in the Actions panel. The title of the Actions panel reflects that code will be attached to the button or movie clip: Actions Panel - Button or Actions Panel - Movie Clip. For guidelines about using code that's attached to button or movie clip instances, see Attaching code to objects.
|
NOTE |
|
Do not confuse button and movie clip event handlers with component events, such as |
You can attach onClipEvent() and on() only to movie clip instances that have been placed on the Stage during authoring. You cannot attach onClipEvent() or on() to movie clip instances that are created at runtime (using the attachMovie() method, for example). To attach event handlers to objects created at runtime, use event handler methods or event listeners. (See About ActionScript and events and Using event listeners.)
|
NOTE |
|
Attaching |
For more information on button and movie clip event handlers, see the following topics:
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000840.html