EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Onmousemove (Mouse.onmousemove Event Listener)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Mouse 435
onMouseMove (Mouse.onMouseMove event
listener)
onMouseMove = function() {}
Notified when the mouse moves. To use the onMouseMove listener, you must create a listener
object. You can then define a function for
onMouseMove and use addListener() to register
the listener with the Mouse object, as shown in the following code:
var someListener:Object = new Object();
someListener.onMouseMove = 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.
Availability: ActionScript 1.0; Flash Lite 2.0
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.
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);

Table of Contents

Related product manuals