Frame Events

From Director Online Wiki
Jump to: navigation, search

Every frame update, Director automatically issues a series of frame events. Use these to run code at specific times on each frame update.

The following is a complete ordered Frame Events-List posted in the DirGamesL-mailing list, by Robert Tweed

(Hope it's ok that I copied it here from the list and edited it. Delete or change it if you want to. --ThomasSchmall)


START: FRAME n

  • If this is the first frame of the movie
  • If there are any new sprites to create
    • For all sprites:
      • new (Sprite n, for each behaviour)
      • beginSprite (Sprite n, for each behaviour)

Draw the frame

  • 'If this is the first frame of the movie

Idle time before next frame

  • idle (Frame)
  • mouseWithin (certain Sprites)
  • [[{idle]] (Frame) -- repeated continuously until it is time for the next frame}

Move frame pointer, if required (by default goes to next frame)

GO TO START

Notes:

  • Events are always sent to sprites in the order 1, 2, 3,..
  • Sometimes the frame receives the event before the sprites, sometimes after the sprites. For which is which, see above.
  • When a new sprite appears in the score, each behaviour is created in turn. On creation, the "new" event is triggered. After all of the behaviours have been instantiated, each instance is sent the beginSprite event in turn. The order of processing always starts with the first behaviour in the list (i.e., scriptInstanceList[1]).