Name
updateAfterEvent( ) Global Function — render the contents of the Stage between frames
Availability
Flash 5
Synopsis
updateAfterEvent( )
Description
The user-input clip event handlers (mouseMove
,
mouseDown
, mouseUp
,
keyDown
, and keyUp
) often
occur between frame renderings in the Flash Player. To force the
screen to reflect visual changes that occur during a user-input clip
event handler, we invoke updateAfterEvent( )
within any of those handlers. Note, however, that
updateAfterEvent( )
is not an arbitrary
screen-refreshing tool; it works only within the user-input clip
events. Outside of onClipEvent( )
handlers, it
has no effect.
Example
The following script attached to a movie clip causes the clip to follow the mouse pointer and refreshes the screen every time the pointer moves. Because we refresh the screen every time the pointer moves, the clip following the pointer animates very smoothly:
onClipEvent (mouseMove) { _x = _root._xmouse; _y = _root._ymouse; updateAfterEvent( ); }
Bugs
Note that the Flash 5 ActionScript Dictionary incorrectly describes
the updateAfterEvent( )
function as accepting a
clip event as an argument. It does not accept any arguments.
See Also
See Section 10.14 in Chapter 10
Get ActionScript: The Definitive Guide 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.