File: events/LMouseEvent.js
/** @language english
* <p>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.</p>
* <p>In a mobile browser, MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE are automatically converted to TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE.</p>
* @class LMouseEvent
* @constructor
* @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), "");
* }
* @examplelink <p><a href="../../../api/LMouseEvent/index.html" target="_blank">Try it »</a></p>
* @public
*/
var LMouseEvent = function (){throw "LMouseEvent cannot be instantiated";};
/** @language english
* <p>[static] Defines the value of the type property of a mouseDown event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* <tr><td>offsetX</td><td>The horizontal coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>offsetY</td><td>The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfX</td><td>The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfY</td><td>The vertical coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>button</td><td>Mouse action.left click:1,right click:2。</td></tr>
* </table>
* @property MOUSE_DOWN
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.MOUSE_DOWN = "mousedown";
/** @language english
* <p>[static] Defines the value of the type property of a mouseUp event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* <tr><td>offsetX</td><td>The horizontal coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>offsetY</td><td>The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfX</td><td>The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfY</td><td>The vertical coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>button</td><td>Mouse action.left click:1,right click:2。</td></tr>
* </table>
* @property MOUSE_UP
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.MOUSE_UP = "mouseup";
LMouseEvent.TOUCH_START = "touchstart";
LMouseEvent.TOUCH_MOVE = "touchmove";
LMouseEvent.TOUCH_END = "touchend";
/** @language english
* <p>[static] Defines the value of the type property of a mouseMove event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* <tr><td>offsetX</td><td>The horizontal coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>offsetY</td><td>The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfX</td><td>The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfY</td><td>The vertical coordinate at which the event occurred in global stage coordinates.</td></tr>
* </table>
* @property MOUSE_MOVE
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.MOUSE_MOVE = "mousemove";
/** @language english
* <p>[static] Defines the value of the type property of a mouseOver event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* <tr><td>offsetX</td><td>The horizontal coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>offsetY</td><td>The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfX</td><td>The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfY</td><td>The vertical coordinate at which the event occurred in global stage coordinates.</td></tr>
* </table>
* @property MOUSE_OVER
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.MOUSE_OVER = "mouseover";
/** @language english
* <p>[static] Defines the value of the type property of a mouseOut event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* </table>
* @property MOUSE_OUT
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.MOUSE_OUT = "mouseout";
/** @language english
* <p>[static] Defines the value of the type property of a doubleClick event object.</p>
* <p>This event has the following properties:</p>
* <table>
* <tr><th>Property</th><th>Value</th></tr>
* <tr><td>currentTarget</td><td>The object that is actively processing the Event object with an event listener.Equivalent to clickTarget.</td></tr>
* <tr><td>target</td><td>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.</td></tr>
* <tr><td>offsetX</td><td>The horizontal coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>offsetY</td><td>The vertical coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfX</td><td>The horizontal coordinate at which the event occurred in the object that is currently processing the event coordinates.</td></tr>
* <tr><td>selfY</td><td>The vertical coordinate at which the event occurred in global stage coordinates.</td></tr>
* <tr><td>button</td><td>Mouse action.left click:1,right click:2。</td></tr>
* </table>
* @property DOUBLE_CLICK
* @type String
* @static
* @since 1.0.0
* @public
*/
LMouseEvent.DOUBLE_CLICK = "dblclick";