User Guide
368 Chapter 6: ActionScript Core Classes
mouseListener.onMouseWheel = function(delta:Number) {
line_mc._rotation += delta;
};
mouseListener.onMouseDown = function() {
trace("Down");
};
Mouse.addListener(mouseListener);
See also
Mouse.addListener(), TextField.mouseWheelEnabled
Mouse.removeListener()
Availability
Flash Player 6.
Usage
Mouse.removeListener (listener:Object) : Boolean
Parameters
listener
An object.
Returns
If the listener object is successfully removed, the method returns true; if the listener is not
successfully removed (for example, if the
listener was not on the Mouse object’s listener list),
the method returns
false.
Description
Method; removes an object that was previously registered with addListener().
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:
/* 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();