API Documentation for: 1.0.0
Show:

MouseEvent Class

Extends Event
Defined in: MouseEvent:41
Module: EaselJS

Passed as the parameter to all mouse/pointer/touch related events. For a listing of mouse events and their properties, see the DisplayObject and Stage event listings.

Constructor

MouseEvent

(
  • type
  • bubbles
  • cancelable
  • stageX
  • stageY
  • nativeEvent
  • pointerID
  • primary
  • rawX
  • rawY
  • relatedTarget
)

Defined in MouseEvent:41

Parameters:

  • type String

    The event type.

  • bubbles Boolean

    Indicates whether the event will bubble through the display list.

  • cancelable Boolean

    Indicates whether the default behaviour of this event can be cancelled.

  • stageX Number

    The normalized x position relative to the stage.

  • stageY Number

    The normalized y position relative to the stage.

  • nativeEvent MouseEvent

    The native DOM event related to this mouse event.

  • pointerID Number

    The unique id for the pointer.

  • primary Boolean

    Indicates whether this is the primary pointer in a multitouch environment.

  • rawX Number

    The raw x position relative to the stage.

  • rawY Number

    The raw y position relative to the stage.

  • relatedTarget DisplayObject

    The secondary target for the event.

Methods

clone

() MouseEvent

Inherited from Event but overwritten in clone:182

Returns a clone of the MouseEvent instance.

Returns:

MouseEvent:

a clone of the MouseEvent instance.

preventDefault

()

Inherited from Event: preventDefault:175

Sets defaultPrevented to true if the event is cancelable. Mirrors the DOM level 2 event standard. In general, cancelable events that have preventDefault() called will cancel the default behaviour associated with the event.

remove

()

Inherited from Event: remove:204

Causes the active listener to be removed via removeEventListener();

    myBtn.addEventListener("click", function(evt) {
        // do stuff...
        evt.remove(); // removes this listener.
    });

set

(
  • props
)
Event chainable

Inherited from Event: set:227

Provides a chainable shortcut method for setting a number of properties on the instance.

Parameters:

  • props Object

    A generic object containing properties to copy to the instance.

Returns:

Event:

Returns the instance the method is called on (useful for chaining calls.)

stopImmediatePropagation

()

Sets propagationStopped and immediatePropagationStopped to true. Mirrors the DOM event standard.

stopPropagation

()

Inherited from Event: stopPropagation:185

Sets propagationStopped to true. Mirrors the DOM event standard.

toString

() String

Inherited from Event but overwritten in toString:191

Returns a string representation of this object.

Returns:

String:

a string representation of the instance.

Properties

bubbles

Boolean readonly

Inherited from Event: bubbles:105

Indicates whether the event will bubble through the display list.

Default: false

cancelable

Boolean readonly

Inherited from Event: cancelable:114

Indicates whether the default behaviour of this event can be cancelled via preventDefault. This is set via the Event constructor.

Default: false

currentTarget

Object readonly

Inherited from Event: currentTarget:80

The current target that a bubbling event is being dispatched from. For non-bubbling events, this will always be the same as target. For example, if childObj.parent = parentObj, and a bubbling event is generated from childObj, then a listener on parentObj would receive the event with target=childObj (the original target) and currentTarget=parentObj (where the listener was added).

Default: null

defaultPrevented

Boolean readonly

Inherited from Event: defaultPrevented:133

Indicates if preventDefault has been called on this event.

Default: false

eventPhase

Number readonly

Inherited from Event: eventPhase:92

For bubbling events, this indicates the current event phase:

  1. capture phase: starting from the top parent to the target
  2. at target phase: currently being dispatched from the target
  3. bubbling phase: from the target to the top parent

Default: 0

immediatePropagationStopped

Boolean readonly

Indicates if stopImmediatePropagation has been called on this event.

Default: false

isTouch

Boolean readonly

Defined in isTouch:161

Indicates whether the event was generated by a touch input (versus a mouse input).

localX

Number readonly

Defined in localX:141

Returns the x position of the mouse in the local coordinate system of the current target (ie. the dispatcher).

localY

Number readonly

Defined in localY:151

Returns the y position of the mouse in the local coordinate system of the current target (ie. the dispatcher).

nativeEvent

HtmlMouseEvent

Defined in nativeEvent:94

The native MouseEvent generated by the browser. The properties and API for this event may differ between browsers. This property will be null if the EaselJS property was not directly generated from a native MouseEvent.

Default: null

pointerID

Number

Defined in pointerID:104

The unique id for the pointer (touch point or cursor). This will be either -1 for the mouse, or the system supplied id value.

primary

Boolean

Defined in primary:112

Indicates whether this is the primary pointer in a multitouch environment. This will always be true for the mouse. For touch pointers, the first pointer in the current stack will be considered the primary pointer.

propagationStopped

Boolean readonly

Inherited from Event: propagationStopped:143

Indicates if stopPropagation or stopImmediatePropagation has been called on this event.

Default: false

rawX

Number

Defined in rawX:78

The raw x position relative to the stage. Normally this will be the same as the stageX value, unless stage.mouseMoveOutside is true and the pointer is outside of the stage bounds.

rawY

Number

Defined in rawY:86

The raw y position relative to the stage. Normally this will be the same as the stageY value, unless stage.mouseMoveOutside is true and the pointer is outside of the stage bounds.

relatedTarget

DisplayObject

Defined in relatedTarget:120

The secondary target for the event, if applicable. This is used for mouseout/ rollout events to indicate the object that the mouse entered from, rollover/ rollover for the object the mouse exited, and stagemousedown/stagemouseup events for the object that was the under the cursor, if any.

Only valid interaction targets will be returned (ie. objects with mouse listeners or a cursor set).

removed

Boolean readonly

Inherited from Event: removed:163

Indicates if remove has been called on this event.

Default: false

stageX

Number

Defined in stageX:64

The normalized x position on the stage. This will always be within the range 0 to stage width.

stageY

Number

Defined in stageY:71

The normalized y position on the stage. This will always be within the range 0 to stage height.

target

Object readonly

Inherited from Event: target:71

The object that generated an event.

Default: null

timeStamp

Number readonly

Inherited from Event: timeStamp:124

The epoch time at which this event was created.

Default: 0

type

String

Inherited from Event: type:64

The type of event.