Table of Contents

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( )


Table of Contents