Event.EventMouse Class

Extends Event

Module: cc

The mouse event

Index

Properties
  • NONE Number The none event code of mouse event.
  • DOWN Number The event type code of mouse down event.
  • UP Number The event type code of mouse up event.
  • MOVE Number The event type code of mouse move event.
  • SCROLL Number The event type code of mouse scroll event.
  • BUTTON_LEFT Number The tag of Mouse left button.
  • BUTTON_RIGHT Number The tag of Mouse right button (The right button number is 2 on browser).
  • BUTTON_MIDDLE Number The tag of Mouse middle button (The right button number is 1 on browser).
  • BUTTON_4 Number The tag of Mouse button 4.
  • BUTTON_5 Number The tag of Mouse button 5.
  • BUTTON_6 Number The tag of Mouse button 6.
  • BUTTON_7 Number The tag of Mouse button 7.
  • BUTTON_8 Number The tag of Mouse button 8.
  • type String The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
  • bubbles Boolean Indicate whether the event bubbles up through the tree or not.
  • target Object A reference to the target to which the event was originally dispatched.
  • currentTarget Object A reference to the currently registered target for the event.
  • eventPhase Number Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:
    • Event.NONE = 0
    • Event.CAPTURING_PHASE = 1
    • Event.AT_TARGET = 2
    • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
Methods
  • setScrollData Sets scroll data.
  • getScrollX Returns the x axis scroll value.
  • getScrollY Returns the y axis scroll value.
  • setLocation Sets cursor location.
  • getLocation Returns cursor location.
  • getLocationInView Returns the current cursor location in screen coordinates.
  • getPreviousLocation Returns the previous touch location.
  • getDelta Returns the delta distance from the previous location to current location.
  • getDeltaX Returns the X axis delta distance from the previous location to current location.
  • getDeltaY Returns the Y axis delta distance from the previous location to current location.
  • setButton Sets mouse button.
  • getButton Returns mouse button.
  • getLocationX Returns location X axis data.
  • getLocationY Returns location Y axis data.
  • constructor
  • unuse Reset the event for being stored in the object pool.
  • reuse Reuse the event for being used again by the object pool.
  • stopPropagation Stops propagation for current event.
  • stopPropagationImmediate Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.
  • isStopped Checks whether the event has been stopped.
  • getCurrentTarget

    Gets current target of the event
    note: It only be available when the event listener is associated with node.

     It returns 0 when the listener is associated with fixed priority.
    
    </p>

  • getType Gets the event type.

Details

Properties

NONE

The none event code of mouse event.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:207
DOWN

The event type code of mouse down event.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:215
UP

The event type code of mouse up event.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:223
MOVE

The event type code of mouse move event.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:231
SCROLL

The event type code of mouse scroll event.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:239
BUTTON_LEFT

The tag of Mouse left button.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:248
BUTTON_RIGHT

The tag of Mouse right button (The right button number is 2 on browser).

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:257
BUTTON_MIDDLE

The tag of Mouse middle button (The right button number is 1 on browser).

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:266
BUTTON_4

The tag of Mouse button 4.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:275
BUTTON_5

The tag of Mouse button 5.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:284
BUTTON_6

The tag of Mouse button 6.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:293
BUTTON_7

The tag of Mouse button 7.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:302
BUTTON_8

The tag of Mouse button 8.

meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:311
type

The name of the event (case-sensitive), e.g. "click", "fire", or "submit".

meta description
Type String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:43
bubbles

Indicate whether the event bubbles up through the tree or not.

meta description
Type Boolean
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:51
target

A reference to the target to which the event was originally dispatched.

meta description
Type Object
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:59
currentTarget

A reference to the currently registered target for the event.

meta description
Type Object
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:67
eventPhase

Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:

  • Event.NONE = 0
  • Event.CAPTURING_PHASE = 1
  • Event.AT_TARGET = 2
  • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow), of the DOM Level 3 Events specification.
meta description
Type Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:75

Methods

setScrollData

Sets scroll data.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:57
Parameters
getScrollX

Returns the x axis scroll value.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:69
getScrollY

Returns the y axis scroll value.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:79
setLocation

Sets cursor location.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:89
Parameters
getLocation

Returns cursor location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:101
getLocationInView

Returns the current cursor location in screen coordinates.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:111
getPreviousLocation

Returns the previous touch location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:126
getDelta

Returns the delta distance from the previous location to current location.

meta description
Returns Vec2
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:136
getDeltaX

Returns the X axis delta distance from the previous location to current location.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:146
getDeltaY

Returns the Y axis delta distance from the previous location to current location.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:156
setButton

Sets mouse button.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:166
Parameters
getButton

Returns mouse button.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:176
getLocationX

Returns location X axis data.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:186
getLocationY

Returns location Y axis data.

meta description
Returns Number
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:196
constructor
meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:37
Parameters
  • type String The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
  • bubbles Boolean A boolean indicating whether the event bubbles up through the tree or not
unuse

Reset the event for being stored in the object pool.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:110
reuse

Reuse the event for being used again by the object pool.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:125
stopPropagation

Stops propagation for current event.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:136
stopPropagationImmediate

Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.

meta description
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:145
isStopped

Checks whether the event has been stopped.

meta description
Returns Boolean
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:155
getCurrentTarget

Gets current target of the event
note: It only be available when the event listener is associated with node.
It returns 0 when the listener is associated with fixed priority.

meta description
Returns Node
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:165
getType

Gets the event type.

meta description
Returns String
Defined in https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:180

results matching ""

    No results matching ""