class openfl.events.MouseEvent extends Event
Available on all platforms
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.
Class Fields
Defines the value of the type property of a
click event object.
This event has the following properties:
static var DOUBLE_CLICK:String
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:
static var MIDDLE_CLICK:String
Defines the value of the type property of a
middleClick event object.
This event has the following properties:
static var MIDDLE_MOUSE_DOWN:String
Defines the value of the type property of a
middleMouseDown event object.
This event has the following properties:
static var MIDDLE_MOUSE_UP:String
Defines the value of the type property of a
middleMouseUp event object.
This event has the following properties:
static var MOUSE_DOWN:String
Defines the value of the type property of a
mouseDown event object.
This event has the following properties:
static var MOUSE_MOVE:String
Defines the value of the type property of a
mouseMove event object.
This event has the following properties:
Defines the value of the type property of a
mouseOut event object.
This event has the following properties:
static var MOUSE_OVER:String
Defines the value of the type property of a
mouseOver event object.
This event has the following properties:
Defines the value of the type property of a
mouseUp event object.
This event has the following properties:
static var MOUSE_WHEEL:String
Defines the value of the type property of a
mouseWheel event object.
This event has the following properties:
static var RIGHT_CLICK:String
Defines the value of the type property of a
rightClick event object.
This event has the following properties:
static var RIGHT_MOUSE_DOWN:String
Defines the value of the type property of a
rightMouseDown event object.
This event has the following properties:
static var RIGHT_MOUSE_UP:String
Defines the value of the type property of a
rightMouseUp event object.
This event has the following properties:
Defines the value of the type property of a
rollOut event object.
This event has the following properties:
Defines the value of the type property of a
rollOver event object.
This event has the following properties:
Instance Fields
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.
var 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.
The horizontal coordinate at which the event occurred in global Stage
coordinates. This property is calculated when the localX
property is set.
The vertical coordinate at which the event occurred in global Stage
coordinates. This property is calculated when the localY
property is set.
function new(type:String, ?bubbles:Bool = true, ?cancelable:Bool = false, ?localX:Float = 0, ?localY:Float = 0, ?relatedObject:InteractiveObject = null, ?ctrlKey:Bool = false, ?altKey:Bool = false, ?shiftKey:Bool = false, ?buttonDown:Bool = false, ?delta:Int = 0, ?commandKey:Bool = false, ?clickCount:Int = 0):Void
Creates an Event object that contains information about mouse events. Event objects are passed as parameters to event listeners.
| 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
|
function updateAfterEvent():Void
Instructs Flash Player or Adobe AIR to render after processing of this event completes, if the display list has been modified.