InputEvent class

The InputEvent is a common base class for MouseEvent and TouchEvent.

This makes it more convenient to use the same event listener for mouse and touch events. The fields that are the same in mouse and touch events are defined in the InputEvent class.

Example:

StageXL.stageOptions.inputEventMode = InputEventMode.MouseAndTouch;

var sprite = new Sprite();
sprite.onMouseDown.listen(onSpriteSelected);
sprite.onTouchBegin.listen(onSpriteSelected);

void onSpriteSelected(InputEvent inputEvent) {
  print("{inputEvent.localX}, {inputEvent.localY});
}
Inheritance
  • Object
  • Event
  • InputEvent
Implementers

Constructors

InputEvent(String type, bool bubbles num localX, num localY, num stageX, num stageY, bool altKey bool ctrlKey bool shiftKey)
Creates a new InputEvent.

Properties

altKey → bool
Indicates whether the Alt key is active (true) or inactive (false).
final
ctrlKey → bool
Indicates whether the Ctrl key is active (true) or inactive (false).
final
isDefaultPrevented → bool
read-only
localX → num
The x-coordinate at which the event occurred relative to the containing display object.
final
localY → num
The y-coordinate at which the event occurred relative to the containing display object.
final
shiftKey → bool
Indicates whether the Shift key is active (true) or inactive (false).
final
stageX → num
The x-coordinate of the input event relative to the stage.
final
stageY → num
The y-coordinate of the input event relative to the stage.
final
bubbles → bool
Indicates whether an event is a bubbling event. If the event can bubble, this value is true; otherwise it is false. [...]
read-only, inherited
captures → bool
Indicates whether an event is a capturing event.
read-only, inherited
currentTarget EventDispatcher
The object that is actively processing the Event object with an event listener. [...]
read-only, inherited
eventPhase EventPhase
The current phase in the event flow. [...]
read-only, inherited
hashCode → int
The hash code for this object.
read-only, inherited
isImmediatePropagationStopped → bool
Indicates if the propagation of this event has been stopped. [...]
read-only, inherited
isPropagationStopped → bool
Indicates if the propagation of this event has been stopped. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
target EventDispatcher
The event target. [...]
read-only, inherited
type → String
The type of event.
read-only, inherited

Methods

preventDefault() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
stopImmediatePropagation() → void
Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow. [...]
inherited
stopPropagation() → void
Prevents processing of any event listeners in nodes subsequent to the current node in the event flow. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Properties

current InputEvent
The mouse or touch event that is currently dispatched. The value is only set if the code is running in the context of a mouse or touch event propagation, otherwise the value is null.
read / write