Flash Lite 2.x and 3.0 ActionScript Language Reference

onMouseUp (Mouse.onMouseUp event listener)

onMouseUp = function() {}

Notified when the mouse button 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.

Note: This event listener is supported in Flash Lite only if System.capabilities.hasMouse is true or System.capabilities.hasStylus is true.

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 by moving the pointer and stops drawing the line by releasing 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);

See also

addListener (Mouse.addListener method)