Message Processing Order

Director generates many events continually. (This is one reason it is hard to follow the output of the trace command in the Message window—there’s too much of it.) Some events are sent every frame, whereas others are sent only at startup or when encountering a new sprite in the Score.

Figure 2-2 shows the Score for my Event Test movie that is used in Example 2-11. (This movie is available from the download site cited in the Preface.)

Event Test Movie

Figure 2-2. Event Test Movie

In Figure 2-2, note the frames in which each sprite begins or end. The frame script and the sprite in channel 5 both span all three frames of the Score (and sprite 5 has two Behaviors attached). The sprite in channel 6 begins in frame 1, ends in frame 2, and has one Behavior attached. The sprite in channel 7 begins and ends in frame 2 and also has one Behavior attached. All sprites also have cast scripts attached to their cast members.

Example 2-11 shows the event sequence generated by the three-frame movie shown in Figure 2-2. You will often ignore the majority of events, but Director sends events in a non-intuitive order that you should understand. Remember that the Stage is drawn between the prepareFrame and enterFrame events, as indicated in Example 2-11.

The number and order of idle events depend on the frameTempo (set to 30 fps in this example) and the idleHandlerPeriod (defaults to 0). In the example ...

Get Lingo in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.