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.
Constructor
new (type:String, bubbles:Bool = true, cancelable:Bool = false, localX:Float = 0, localY:Float = 0, ?relatedObject:InteractiveObject, ctrlKey:Bool = false, altKey:Bool = false, shiftKey:Bool = false, buttonDown:Bool = false, delta:Int = 0, commandKey:Bool = false, clickCount:Int = 0)
Creates an Event object that contains information about mouse events. Event objects are passed as parameters to event listeners.
Parameters:
type | The type of the event. Possible values are:
|
---|---|
bubbles | Determines whether the Event object participates in the bubbling phase of the event flow. |
cancelable | Determines whether the Event object can be canceled. |
localX | The horizontal coordinate at which the event occurred relative to the containing sprite. |
localY | The vertical coordinate at which the event occurred relative to the containing sprite. |
relatedObject | The complementary InteractiveObject instance that is
affected by the event. For example, when a
|
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. |
altKey | Indicates whether the Alt key is activated(Windows or Linux only). |
shiftKey | Indicates whether the Shift key is activated. |
buttonDown | Indicates whether the primary mouse button is pressed. |
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
|
Variables
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
.
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.
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.
relatedObject:InteractiveObject
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.
Methods
Static variables
staticinline read onlyCLICK:String = "click"
Defines the value of the type
property of a
click
event object.
This event has the following properties:
staticinline read onlyDOUBLE_CLICK:String = "doubleClick"
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:
staticinline read onlyMIDDLE_CLICK:String = "middleClick"
Defines the value of the type
property of a
middleClick
event object.
This event has the following properties:
staticinline read onlyMIDDLE_MOUSE_DOWN:String = "middleMouseDown"
Defines the value of the type
property of a
middleMouseDown
event object.
This event has the following properties:
staticinline read onlyMIDDLE_MOUSE_UP:String = "middleMouseUp"
Defines the value of the type
property of a
middleMouseUp
event object.
This event has the following properties:
staticinline read onlyMOUSE_DOWN:String = "mouseDown"
Defines the value of the type
property of a
mouseDown
event object.
This event has the following properties:
staticinline read onlyMOUSE_MOVE:String = "mouseMove"
Defines the value of the type
property of a
mouseMove
event object.
This event has the following properties:
staticinline read onlyMOUSE_OUT:String = "mouseOut"
Defines the value of the type
property of a
mouseOut
event object.
This event has the following properties:
staticinline read onlyMOUSE_OVER:String = "mouseOver"
Defines the value of the type
property of a
mouseOver
event object.
This event has the following properties:
staticinline read onlyMOUSE_UP:String = "mouseUp"
Defines the value of the type
property of a
mouseUp
event object.
This event has the following properties:
staticinline read onlyMOUSE_WHEEL:String = "mouseWheel"
Defines the value of the type
property of a
mouseWheel
event object.
This event has the following properties:
staticinline read onlyRELEASE_OUTSIDE:String = "releaseOutside"
Defines the value of the type
property of a
releaseOutside
event object.
This event has the following properties:
staticinline read onlyRIGHT_CLICK:String = "rightClick"
Defines the value of the type
property of a
rightClick
event object.
This event has the following properties:
staticinline read onlyRIGHT_MOUSE_DOWN:String = "rightMouseDown"
Defines the value of the type
property of a
rightMouseDown
event object.
This event has the following properties:
staticinline read onlyRIGHT_MOUSE_UP:String = "rightMouseUp"
Defines the value of the type
property of a
rightMouseUp
event object.
This event has the following properties: