#

API Documentation for: NEXT
Show: Inherited Protected Private Deprecated

# MouseEvent Class

Extends Event
Defined in: `MouseEvent:39`
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`

)

Defined in `MouseEvent:39`

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

- Index
- Methods
- Properties
- Events

## Item Index

### Methods

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

### Properties

- bubbles
- cancelable
- currentTarget
- defaultPrevented
- Event_initialize
- eventPhase
- immediatePropagationStopped
- localX
- localY
- nativeEvent
- onMouseMove deprecated
- onMouseUp deprecated
- pointerID
- primary
- propagationStopped
- rawX
- rawY
- removed
- stageX
- stageY
- target
- timeStamp
- type

### Events

- mousemove deprecated
- mouseup deprecated

## Methods

### `clone`

() MouseEvent

Inherited from Event but overwritten in `clone:222`

Returns a clone of the MouseEvent instance.

#### Returns:

MouseEvent:

a clone of the MouseEvent instance.

### `initialize`

(

- `type`
- `bubbles`
- `cancelable`
- `stageX`
- `stageY`
- `nativeEvent`
- `pointerID`
- `primary`
- `rawX`
- `rawY`

)
protected

Inherited from Event but overwritten in `initialize:195`

Initialization method.

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

### `preventDefault`

()

Inherited from Event: `preventDefault:194`

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

### `remove`

()

Inherited from Event: `remove:222`

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

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

### `set`

(

- `props`

)
Event

Inherited from Event: `set:245`

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

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

### `stopPropagation`

()

Inherited from Event: `stopPropagation:203`

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

### `toString`

() String

Inherited from Event but overwritten in `toString:231`

Returns a string representation of this object.

#### Returns:

String:

a string representation of the instance.

## Properties

### `bubbles`

Boolean

Inherited from Event: `bubbles:109`

Indicates whether the event will bubble through the display list.

Default: false

### `cancelable`

Boolean

Inherited from Event: `cancelable:118`

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

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

Indicates if preventDefault has been called on this event.

Default: false

### `Event_initialize`

Function private

Defined in `Event_initialize:188`

### `eventPhase`

Number

Inherited from Event: `eventPhase:96`

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

Indicates if stopImmediatePropagation has been called on this event.

Default: false

### `localX`

Number

Defined in `localX:160`

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

### `localY`

Number

Defined in `localY:170`

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

### `nativeEvent`

HtmlMouseEvent

Defined in `nativeEvent:117`

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

### `onMouseMove`

Function deprecated

Defined in `onMouseMove:128`

Deprecated: Use the DisplayObject "pressmove" event.

REMOVED. Use the DisplayObject pressmove event.

### `onMouseUp`

Function deprecated

Defined in `onMouseUp:135`

Deprecated: Use the DisplayObject "pressup" event.

REMOVED. Use the DisplayObject pressup event.

### `pointerID`

Number

Defined in `pointerID:143`

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

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

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

Default: false

### `rawX`

Number

Defined in `rawX:101`

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

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.

### `removed`

Boolean

Inherited from Event: `removed:167`

Indicates if remove has been called on this event.

Default: false

### `stageX`

Number

Defined in `stageX:87`

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

### `stageY`

Number

Defined in `stageY:94`

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

### `target`

Object

Inherited from Event: `target:75`

The object that generated an event.

Default: null

### `timeStamp`

Number

Inherited from Event: `timeStamp:128`

The epoch time at which this event was created.

Default: 0

### `type`

String

Inherited from Event: `type:68`

The type of event.

## Events

### `mousemove`

deprecated

Defined in `mousemove:63`

Deprecated: In favour of the DisplayObject "pressmove" event.

Available since 0.6.0

REMOVED. For MouseEvent objects of type "mousedown", mousemove events will be dispatched from the event object until the user releases the mouse anywhere. This enables you to listen to mouse move interactions for the duration of a press, which can be very useful for operations such as drag and drop.

See the MouseEvent class description for more information on mouse events.

### `mouseup`

deprecated

Defined in `mouseup:74`

Deprecated: In favour of the DisplayObject "pressup" event.

Available since 0.6.0

REMOVED. For MouseEvent objects of type "mousedown", a mouseup event will be dispatched from the event object when the user releases the mouse anywhere. This enables you to listen for a corresponding mouse up from a specific press, which can be very useful for operations such as drag and drop.

See the MouseEvent class description for more information on mouse events.