onMouseUp (Mouse.onMouseUp event listener)

onMouseUp = function() {}

Notified when the mouse is released. To use the onMouseUp listener, you must create a listener object. You can then define a function for onMouseUp and use addListener() to register the listener with the Mouse object, as shown in the following code:

var someListener:Object = new Object();
someListener.onMouseUp = function () { ... };
Mouse.addListener(someListener);

Listeners enable different pieces of code to cooperate because multiple listeners can receive notification about a single event.

A Flash application can only monitor mouse events that occur within its focus. A Flash application cannot detect mouse events in another application.

Availability: ActionScript 1.0; Flash Player 6

Example

The following example uses the mouse pointer as a tool to draw lines using onMouseMove and the Drawing API. The user draws a line when they drag the mouse pointer. The user stops drawing the line when they release the mouse button.

this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
    this.isDrawing = true;
    canvas_mc.lineStyle(2, 0xFF0000, 100);
    canvas_mc.moveTo(_xmouse, _ymouse);
};
mouseListener.onMouseMove = function() {
    if (this.isDrawing) {
        canvas_mc.lineTo(_xmouse, _ymouse);
    }
    updateAfterEvent();
};
mouseListener.onMouseUp = function() {
    this.isDrawing = false;
};
Mouse.addListener(mouseListener);

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

addListener (Mouse.addListener method)