LMouseEvent Class
A LMouseEvent object is dispatched into the event flow whenever mouse events occur. A mouse event is usually generated by a user input device, such as a mouse or a trackball, that uses a pointer.
In a mobile browser, MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE are automatically converted to TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE.
Constructor
LMouseEvent
()
public
Example:
LInit(50, "legend", 800, 480, main);
function main () {
LGlobal.setDebug(true);
var layer01 = new LSprite();
layer01.x = 50;
layer01.y = 20;
addChild(layer01);
var bmd = new LBitmapData("#FF0000", 0, 0, 100, 100);
var bm = new LBitmap(bmd);
layer01.addChild(bm);
layer01.addEventListener(LMouseEvent.MOUSE_DOWN, onmouse);
layer01.addEventListener(LMouseEvent.MOUSE_DOWN, onmouseOther);
var layer02 = new LSprite();
layer02.graphics.drawRect(1,"#008800",[0,0,100,100],true);
layer02.x = 200;
layer02.y = 20;
addChild(layer02);
layer02.addEventListener(LMouseEvent.MOUSE_DOWN, onmouse);
layer02.addEventListener(LMouseEvent.MOUSE_DOWN, onmouseOther);
}
function onmouse(event){
trace("event.currentTarget : " + event.currentTarget + "(" + event.currentTarget.objectIndex + ")");
trace("event.target : " + event.target + "(" + event.target.objectIndex + ")");
trace("event.clickTarget == event.currentTarget : " + (event.clickTarget == event.currentTarget));
trace("event.offsetX : " + event.offsetX, "event.offsetY : " + event.offsetY);
trace("event.selfX : " + event.selfX, "event.selfY : " + event.selfY, "");
}
function onmouseOther(event,object){
trace("onmouseOther event.currentTarget : " + event.currentTarget + "(" + event.currentTarget.objectIndex + ")");
trace("onmouseOther object : " + object + "(" + object.objectIndex + ")");
trace("onmouseOther object == event.currentTarget : " + (object == event.currentTarget), "");
}
Item Index
Properties
- DOUBLE_CLICK static
- MOUSE_DOWN static
- MOUSE_MOVE static
- MOUSE_OUT static
- MOUSE_OVER static
- MOUSE_UP static
Properties
DOUBLE_CLICK
String
public
static
[static] Defines the value of the type property of a doubleClick event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
offsetX | The horizontal coordinate at which the event occurred in global stage coordinates. |
offsetY | The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfX | The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfY | The vertical coordinate at which the event occurred in global stage coordinates. |
button | Mouse action.left click:1,right click:2。 |
MOUSE_DOWN
String
public
static
[static] Defines the value of the type property of a mouseDown event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
offsetX | The horizontal coordinate at which the event occurred in global stage coordinates. |
offsetY | The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfX | The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfY | The vertical coordinate at which the event occurred in global stage coordinates. |
button | Mouse action.left click:1,right click:2。 |
MOUSE_MOVE
String
public
static
[static] Defines the value of the type property of a mouseMove event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
offsetX | The horizontal coordinate at which the event occurred in global stage coordinates. |
offsetY | The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfX | The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfY | The vertical coordinate at which the event occurred in global stage coordinates. |
MOUSE_OUT
String
public
static
[static] Defines the value of the type property of a mouseOut event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
MOUSE_OVER
String
public
static
[static] Defines the value of the type property of a mouseOver event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
offsetX | The horizontal coordinate at which the event occurred in global stage coordinates. |
offsetY | The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfX | The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfY | The vertical coordinate at which the event occurred in global stage coordinates. |
MOUSE_UP
String
public
static
[static] Defines the value of the type property of a mouseUp event object.
This event has the following properties:
Property | Value |
---|---|
currentTarget | The object that is actively processing the Event object with an event listener.Equivalent to clickTarget. |
target | The LInteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event. |
offsetX | The horizontal coordinate at which the event occurred in global stage coordinates. |
offsetY | The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfX | The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates. |
selfY | The vertical coordinate at which the event occurred in global stage coordinates. |
button | Mouse action.left click:1,right click:2。 |