openfl
Version:
A fast, productive library for 2D cross-platform development.
325 lines (277 loc) • 10.6 kB
TypeScript
import Event from "./Event";
import InteractiveObject from "./../display/InteractiveObject";
declare namespace openfl.events {
/**
* A MouseEvent 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.
*
* When nested nodes are involved, mouse events target the deepest possible
* nested node that is visible in the display list. This node is called the
* _target node_. To have a target node's ancestor receive notification
* of a mouse event, use `EventDispatcher.addEventListener()` on
* the ancestor node with the `type` parameter set to the specific
* mouse event you want to detect.
*
*/
export class MouseEvent extends Event {
/**
* Defines the value of the `type` property of a
* `click` event object.
*
* This event has the following properties:
*/
public static CLICK:string;
// #if flash
// @:noCompletion @:dox(hide) @:require(flash11_2) public static var CONTEXT_MENU:string;
// #end
/**
* Defines the value of the `type` property of a
* `doubleClick` event object. The `doubleClickEnabled`
* property must be `true` for an object to generate the
* `doubleClick` event.
*
* This event has the following properties:
*/
public static DOUBLE_CLICK:string;
/**
* Defines the value of the `type` property of a
* `middleClick` event object.
*
* This event has the following properties:
*/
public static MIDDLE_CLICK:string;
/**
* Defines the value of the `type` property of a
* `middleMouseDown` event object.
*
* This event has the following properties:
*/
public static MIDDLE_MOUSE_DOWN:string;
/**
* Defines the value of the `type` property of a
* `middleMouseUp` event object.
*
* This event has the following properties:
*/
public static MIDDLE_MOUSE_UP:string;
/**
* Defines the value of the `type` property of a
* `mouseDown` event object.
*
* This event has the following properties:
*/
public static MOUSE_DOWN:string;
/**
* Defines the value of the `type` property of a
* `mouseMove` event object.
*
* This event has the following properties:
*/
public static MOUSE_MOVE:string;
/**
* Defines the value of the `type` property of a
* `mouseOut` event object.
*
* This event has the following properties:
*/
public static MOUSE_OUT:string;
/**
* Defines the value of the `type` property of a
* `mouseOver` event object.
*
* This event has the following properties:
*/
public static MOUSE_OVER:string;
/**
* Defines the value of the `type` property of a
* `mouseUp` event object.
*
* This event has the following properties:
*/
public static MOUSE_UP:string;
/**
* Defines the value of the `type` property of a
* `mouseWheel` event object.
*
* This event has the following properties:
*/
public static MOUSE_WHEEL:string;
/**
* Defines the value of the `type` property of a
* `releaseOutside` event object.
*
* This event has the following properties:
*/
public static RELEASE_OUTSIDE:string;
/**
* Defines the value of the `type` property of a
* `rightClick` event object.
*
* This event has the following properties:
*/
public static RIGHT_CLICK:string;
/**
* Defines the value of the `type` property of a
* `rightMouseDown` event object.
*
* This event has the following properties:
*/
public static RIGHT_MOUSE_DOWN:string;
/**
* Defines the value of the `type` property of a
* `rightMouseUp` event object.
*
* This event has the following properties:
*/
public static RIGHT_MOUSE_UP:string;
/**
* Defines the value of the `type` property of a
* `rollOut` event object.
*
* This event has the following properties:
*/
public static ROLL_OUT:string;
/**
* Defines the value of the `type` property of a
* `rollOver` event object.
*
* This event has the following properties:
*/
public static ROLL_OVER:string;
/**
* Indicates whether the Alt key is active(`true`) or inactive
* (`false`). Supported for Windows only. On other operating
* systems, this property is always set to `false`.
*/
public altKey:boolean;
/**
* Indicates whether the primary mouse button is pressed(`true`)
* or not(`false`).
*/
public buttonDown:boolean;
public clickCount:number;
public commandKey:boolean;
/**
* On Windows or Linux, indicates whether the Ctrl key is active
* (`true`) or inactive(`false`). On Macintosh,
* indicates whether either the Control key or the Command key is activated.
*/
public ctrlKey:boolean;
/**
* Indicates how many lines should be scrolled for each unit the user rotates
* the mouse wheel. A positive delta value indicates an upward scroll; a
* negative value indicates a downward scroll. Typical values are 1 to 3, but
* faster rotation may produce larger values. This setting depends on the
* device and operating system and is usually configurable by the user. This
* property applies only to the `MouseEvent.mouseWheel` event.
*/
public delta:number;
public isRelatedObjectInaccessible:boolean;
/**
* The horizontal coordinate at which the event occurred relative to the
* containing sprite.
*/
public localX:number;
/**
* The vertical coordinate at which the event occurred relative to the
* containing sprite.
*/
public localY:number;
// #if flash
// @:noCompletion @:dox(hide) @:require(flash11_2) public var movementX:number;
// #end
// #if flash
// @:noCompletion @:dox(hide) @:require(flash11_2) public var movementY:number;
// #end
/**
* A reference to a display list object that is related to the event. For
* example, when a `mouseOut` event occurs,
* `relatedObject` represents the display list object to which the
* pointing device now points. This property applies to the
* `mouseOut`, `mouseOver`, `rollOut`, and
* `rollOver` events.
*
* The value of this property can be `null` in two
* circumstances: if there no related object, or there is a related object,
* but it is in a security sandbox to which you don't have access. Use the
* `isRelatedObjectInaccessible()` property to determine which of
* these reasons applies.
*/
public relatedObject:InteractiveObject;
/**
* Indicates whether the Shift key is active(`true`) or inactive
* (`false`).
*/
public shiftKey:boolean;
/**
* The horizontal coordinate at which the event occurred in global Stage
* coordinates. This property is calculated when the `localX`
* property is set.
*/
public stageX:number;
/**
* The vertical coordinate at which the event occurred in global Stage
* coordinates. This property is calculated when the `localY`
* property is set.
*/
public stageY:number;
/**
* Creates an Event object that contains information about mouse events.
* Event objects are passed as parameters to event listeners.
*
* @param type The type of the event. Possible values are:
* `MouseEvent.CLICK`,
* `MouseEvent.DOUBLE_CLICK`,
* `MouseEvent.MOUSE_DOWN`,
* `MouseEvent.MOUSE_MOVE`,
* `MouseEvent.MOUSE_OUT`,
* `MouseEvent.MOUSE_OVER`,
* `MouseEvent.MOUSE_UP`,
* `MouseEvent.MIDDLE_CLICK`,
* `MouseEvent.MIDDLE_MOUSE_DOWN`,
* `MouseEvent.MIDDLE_MOUSE_UP`,
* `MouseEvent.RIGHT_CLICK`,
* `MouseEvent.RIGHT_MOUSE_DOWN`,
* `MouseEvent.RIGHT_MOUSE_UP`,
* `MouseEvent.MOUSE_WHEEL`,
* `MouseEvent.ROLL_OUT`, and
* `MouseEvent.ROLL_OVER`.
* @param bubbles Determines whether the Event object participates in
* the bubbling phase of the event flow.
* @param cancelable Determines whether the Event object can be canceled.
* @param localX The horizontal coordinate at which the event occurred
* relative to the containing sprite.
* @param localY The vertical coordinate at which the event occurred
* relative to the containing sprite.
* @param relatedObject The complementary InteractiveObject instance that is
* affected by the event. For example, when a
* `mouseOut` event occurs,
* `relatedObject` represents the display
* list object to which the pointing device now points.
* @param ctrlKey On Windows or Linux, indicates whether the Ctrl key
* is activated. On Mac, indicates whether either the
* Ctrl key or the Command key is activated.
* @param altKey Indicates whether the Alt key is activated(Windows
* or Linux only).
* @param shiftKey Indicates whether the Shift key is activated.
* @param buttonDown Indicates whether the primary mouse button is
* pressed.
* @param delta Indicates how many lines should be scrolled for each
* unit the user rotates the mouse wheel. A positive
* delta value indicates an upward scroll; a negative
* value indicates a downward scroll. Typical values are
* 1 to 3, but faster rotation may produce larger
* values. This parameter is used only for the
* `MouseEvent.mouseWheel` event.
*/
public constructor (type:string, bubbles?:boolean, cancelable?:boolean, localX?:number, localY?:number, relatedObject?:InteractiveObject, ctrlKey?:boolean, altKey?:boolean, shiftKey?:boolean, buttonDown?:boolean, delta?:number, commandKey?:boolean, clickCount?:number);
/**
* Instructs Flash Player or Adobe AIR to render after processing of this
* event completes, if the display list has been modified.
*
*/
public updateAfterEvent ():void;
}
}
export default openfl.events.MouseEvent;