Mouse.onMouseUp( ) Listener Event

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Mouse.onMouseUp( ) Listener Event Flash 6

occurs when the primary mouse button is released
listener.onMouseUp()

Description

The onMouseUp( ) event is the counterpart of onMouseDown( ). It occurs each time the primary mouse button is pressed (while the mouse pointer is over any part of the Stage) and then released.

To respond to an onMouseUp( ) event, we must assign a callback function to the onMouseUp property of some object, such as listener, and then add listener as a listener using Mouse.addListener( ), as follows:

// Create a generic object (although it can be any type of object) mouseListener = new Object();     // Assign a callback function to the object's onMouseUp property mouseListener.onMouseUp = function () {   trace("The mouse was released!"); }     // Register the listener with the Mouse object Mouse.addListener(mouseListener);

Any number of listener objects of any class can respond to the onMouseUp( ) event.

The onMouseUp( ) event executes immediately when the mouse is released, independently of the code on a movie's timeline(s). However, visual changes to the movie made by the listener are not rendered until the next frame refresh, which is determined by the frame rate of the movie. Unfortunately, in Flash 6, updateAfterEvent( ) cannot be used to force a screen refresh from within an onMouseUp( ) listener; updateAfterEvent( ) has an effect only when invoked either from a movie clip mouse or key event or a setInterval( ) callback.

See Also

Button.onRelease( ), Mouse.addListener( ), Mouse.onMouseDown( ), Mouse.onMouseMove( ), MovieClip.onMouseUp( )



    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