API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LMouseEvent Class

Available since 1.0.0

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

Defined in events/LMouseEvent.js:1

Available since 1.0.0

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

Properties

DOUBLE_CLICK

String public static

Defined in events/LMouseEvent.js:141

Available since 1.0.0

[static] Defines the value of the type property of a doubleClick event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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.
offsetXThe horizontal coordinate at which the event occurred in global stage coordinates.
offsetYThe vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfXThe horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfYThe vertical coordinate at which the event occurred in global stage coordinates.
buttonMouse action.left click:1,right click:2。

MOUSE_DOWN

String public static

Defined in events/LMouseEvent.js:45

Available since 1.0.0

[static] Defines the value of the type property of a mouseDown event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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.
offsetXThe horizontal coordinate at which the event occurred in global stage coordinates.
offsetYThe vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfXThe horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfYThe vertical coordinate at which the event occurred in global stage coordinates.
buttonMouse action.left click:1,right click:2。

MOUSE_MOVE

String public static

Defined in events/LMouseEvent.js:88

Available since 1.0.0

[static] Defines the value of the type property of a mouseMove event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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.
offsetXThe horizontal coordinate at which the event occurred in global stage coordinates.
offsetYThe vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfXThe horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfYThe vertical coordinate at which the event occurred in global stage coordinates.

MOUSE_OUT

String public static

Defined in events/LMouseEvent.js:126

Available since 1.0.0

[static] Defines the value of the type property of a mouseOut event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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

Defined in events/LMouseEvent.js:107

Available since 1.0.0

[static] Defines the value of the type property of a mouseOver event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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.
offsetXThe horizontal coordinate at which the event occurred in global stage coordinates.
offsetYThe vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfXThe horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfYThe vertical coordinate at which the event occurred in global stage coordinates.

MOUSE_UP

String public static

Defined in events/LMouseEvent.js:65

Available since 1.0.0

[static] Defines the value of the type property of a mouseUp event object.

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.Equivalent to clickTarget.
targetThe 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.
offsetXThe horizontal coordinate at which the event occurred in global stage coordinates.
offsetYThe vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfXThe horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.
selfYThe vertical coordinate at which the event occurred in global stage coordinates.
buttonMouse action.left click:1,right click:2。