|
Using ActionScript event methods
Macromedia Flash MX ActionScript introduces a new event model that makes it easier to handle events in a Macromedia Flash document. In Macromedia Flash 5 ActionScript, events that you could handle included mouse clicks, keyboard input, interaction between a client and a server, and loading and unloading of movie clips. Macromedia Flash MX lets you handle not only those events but also tab order events, selection events, text field events, and more sophisticated data events. The Macromedia Flash MX event model also allows you to access events as methods, instead of only through the on and onClipEvent actions. In this tutorial, you'll learn to write simple ActionScript code that uses event methods to handle button and movie clip events in a Macromedia Flash document.
This tutorial is intended for Macromedia Flash users who have a basic familiarity with ActionScript. For best results in completing this tutorial, you should be familiar with the Macromedia Flash Actions panel and know how to assign actions to frames, buttons, and movie clips. For more information, see Flash MX Help > Using Flash > Writing Scripts with ActionScript. You can also complete the Introduction to ActionScript tutorial, see Flash MX Help > Tutorials.
In Macromedia Flash 5, event handling was performed inside the on and onClipEvent actions attached to buttons or movie clips. Macromedia Flash MX introduces event methods that you include in scripts that can be assigned to any frame or object in a document, not just to the object whose event is being handled. For example, you could control all the events in a movie from a single frame. This makes event handling more powerful and also easier to understand and use.
Download the Windows event_methods source file (8K)
Download the Macintosh event_methods source file (8K)
If you have trouble downloading or decompressing the files, see TechNote 13686.
- About event methods
- Call an event method
- Assign a function to an event method
- Use the this keyword inside a function
- Use a button event method with a movie clip
- Use event methods in a Flash document
- Moving forward
 |
 |
Jody Bleyle
Jody Bleyle writes instructional documentation for Macromedia Flash
and has served as the Flash Technical Support team lead.
|
|
 |
14 March 2002 |
|
 |
Flash, tutorial, event, handler, event model, event method, on, onClipEvent, onPress, onRelease, onEnterFrame, routine, ActionScript, action |
|
 |
9909 |
 |
 |
|
|