Macromedia Director MX 2004: Training from the Source
As I mentioned earlier, events are either generated by the user or by Director. In the normal course of playing your movie, Director generates a number of events that you can either ignore or take advantage of by writing handlers. However, you'll need to know what these events are, and the order in which they happen if you're to use them properly. There are nine events that Director will generate broken down as follows: prepareMovie The very first event fired when the movie is played. To handle this event you need a handler placed in a movie script. beginSprite Event two if there's a sprite on frame 1. Also happens whenever the playhead enters a new sprite span. This event can be handled by placing a handler within a sprite's behavior script. stepFrame This is the third event and is special in that it can only be handled by an object on the actorList. You'll learn more about the actorList in Lesson 12. prepareFrame Event four, generated for both sprite and frame scripts. The sprite receives the event before the frame. This event can be handled through a handler within a sprite's behavior or a handler within a frame behavior. startMovie Event five. To handle this event you must place a handler within a movie script. enterFrame Event six, generated for both sprite and frame scripts. The sprite receives the event before the frame. You can handle this event through a sprite behavior or a frame behavior. exitFrame Event seven, generated for both sprite and frame scripts. The sprite receives the event before the frame. You can handle this event through a sprite behavior or a frame behavior. stopMovie Event eight, generated when the movie stops play back. To handle this event you must place a handler within a movie script. endSprite Event nine. When the movie stops this event is sent to the sprite after the stopMovie is generated. This event is also generated each time the playhead leaves a sprite span. Place a handler within a sprite's behavior script to handle this event. Because it always helps to visualize something to learn it, included on the CD in the Lesson04 folder is a file named events.dir.
|