onMouseUp (Mouse.onMouseUp event listener)
onMouseUp = function() {}
Notified when the mouse is released. To use the
object. You can then define a function for
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
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()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
See also
addListener (Mouse.addListener method)
812
ActionScript classes
onMouseUp
and use
onMouseUp
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
listener, you must create a listener
to register the
addListener()
onMouseMove
method.
and
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?