EnterFrame

From Director Online Wiki
Jump to: navigation, search

Use enterFrame in preference to any other frame event for all operations that require any lengthy calculations.

The Director Player calls enterFrame each time the Stage has been updated. It will then begin a cycle of #idle and #mouseWithin events, until it is time for the next frame to be displayed. If you place a lengthy calculation in an on enterFrame() handler, Director will automatically reduce the number of #idle and #mouseWithin events that it issues. If you place a lengthy calculation in (say) an exitFrame() handler, Director will already have issued a number of #idle and #mouseWithin events, and will still have to run the lengthy calculation. As a result, the display of the following frame will be delayed.