Mouse.removeListener()
Availability
Flash Player 6.
Usage
Mouse.removeListener (listener:Object) : Boolean
Parameters
An object.
listener
Returns
If the
listener
successfully removed (for example, if the
the method returns
Description
Method; removes an object that was previously registered with
Example
The following example attaches three buttons to the Stage, and lets the user draw lines in the
SWF file at runtime, using the mouse pointer. One button clears all of the lines from the SWF
file. The second button removes the mouse listener so the user cannot draw lines. The third
button adds the mouse listener after it is removed, so the user can draw lines again. Add the
following ActionScript to Frame 1 of the Timeline:
/* Add an instance of the Button
component to be placed in the Library.
This example attaches and positions three Button
instances on the Stage. */
this.createClassObject(mx.controls.Button, "clear_button",
this.getNextHighestDepth(), {_x:10, _y:10, label:'clear'});
this.createClassObject(mx.controls.Button, "stopDrawing_button",
this.getNextHighestDepth(), {_x:120, _y:10, label:'stop drawing'});
this.createClassObject(mx.controls.Button, "startDrawing_button",
this.getNextHighestDepth(), {_x:230, _y:10, label:'start drawing'});
startDrawing_button.enabled = false;
//
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();
};
486
Chapter 2: ActionScript Language Reference
object is successfully removed, the method returns
.
false
was not on the Mouse object's listener list),
listener
; if the
true
listener
.
addListener()
is not
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers