updateAfterEvent( ) Global Function

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
updateAfterEvent( ) Global Function Flash 5

render the contents of the Stage between frames
updateAfterEvent()

Description

When a function executes between frames in the Flash Player, any visual changes to the screen are not displayed until the next frame is rendered. However, within the following functions, we can force a screen refresh manually by invoking updateAfterEvent( ):

  • A setInterval( ) callback

  • MovieClip.onMouseMove( )

  • MovieClip.onMouseDown( )

  • MovieClip.onMouseUp( )

  • MovieClip.onKeyDown( )

  • MovieClip.onKeyUp( )

Note, however, that updateAfterEvent( ) is not an arbitrary screen-refreshing tool; outside of setInterval( ) and the handlers in the previous list, it has no effect. In Flash 6, even the Mouse and Key objects' event handlers do not support updateAfterEvent( ); however, they are expected to support it in future versions of the Player.

Example

The following script causes pointer_mc to follow the mouse pointer. It uses updateAfterEvent( ) to refresh the screen every time the pointer moves (which may be more often than the frame rate):

pointer_mc.onMouseMove = function () {   this._x = _root._xmouse;   this._y = _root._ymouse;   updateAfterEvent(); }

See Also

"Refreshing the Screen with updateAfterEvent( )," in Chapter 10



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net