#

API Documentation for: NEXT
Show: Inherited Protected Private Deprecated

# 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.

- Index
- Methods
- Properties

## Item Index

### Methods

- clone
- initialize deprecated
- preventDefault
- remove
- set
- stopImmediatePropagation
- stopPropagation
- toString

### Properties

- bubbles
- cancelable
- currentTarget
- defaultPrevented
- eventPhase
- immediatePropagationStopped
- isTouch
- localX
- localY
- nativeEvent
- pointerID
- primary
- propagationStopped
- rawX
- rawY
- relatedTarget
- removed
- stageX
- stageY
- target
- timeStamp
- type

## Methods

### `clone`

() MouseEvent

Inherited from Event but overwritten in `clone:179`

Returns a clone of the MouseEvent instance.

#### Returns:

MouseEvent:

a clone of the MouseEvent instance.

### `initialize`

() deprecated protected

Inherited from Event: `initialize:174`

REMOVED. Removed in favor of using `MySuperClass_constructor`. See extend and promote for details.

There is an inheritance tutorial distributed with EaselJS in /tutorials/Inheritance.

### `preventDefault`

()

Inherited from Event: `preventDefault:188`

Sets Event/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:217`

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:240`

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`

()

Inherited from Event: `stopImmediatePropagation:207`

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

### `stopPropagation`

()

Inherited from Event: `stopPropagation:198`

Sets Event/propagationStopped to true. Mirrors the DOM event standard.

### `toString`

() String

Inherited from Event but overwritten in `toString:188`

Returns a string representation of this object.

#### Returns:

String:

a string representation of the instance.

## Properties

### `bubbles`

Boolean

Inherited from Event: `bubbles:105`

Indicates whether the event will bubble through the display list.

Default: false

### `cancelable`

Boolean

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

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

Inherited from Event: `defaultPrevented:133`

Indicates if preventDefault has been called on this event.

Default: false

### `eventPhase`

Number

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

Inherited from Event: `immediatePropagationStopped:153`

Indicates if stopImmediatePropagation has been called on this event.

Default: false

### `isTouch`

Boolean

Defined in `isTouch:158`

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

### `localX`

Number

Defined in `localX:138`

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

### `localY`

Number

Defined in `localY:148`

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

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, mouseover/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

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

Inherited from Event: `target:71`

The object that generated an event.

Default: null

### `timeStamp`

Number

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.