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.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.
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,...isStopped
Checks whether the event has been stopped.getCurrentTarget
note: It only be available when the event listener is associated with node.getType
Gets the event type.
Details
Properties
NONE
The none event code of mouse event.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:208 |
DOWN
The event type code of mouse down event.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:216 |
UP
The event type code of mouse up event.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:224 |
MOVE
The event type code of mouse move event.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:232 |
SCROLL
The event type code of mouse scroll event.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:240 |
BUTTON_LEFT
The tag of Mouse left button.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:249 |
BUTTON_RIGHT
The tag of Mouse right button (The right button number is 2 on browser).
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:258 |
BUTTON_MIDDLE
The tag of Mouse middle button (The right button number is 1 on browser).
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:267 |
BUTTON_4
The tag of Mouse button 4.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:276 |
BUTTON_5
The tag of Mouse button 5.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:285 |
BUTTON_6
The tag of Mouse button 6.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:294 |
BUTTON_7
The tag of Mouse button 7.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:303 |
BUTTON_8
The tag of Mouse button 8.
meta | description |
---|---|
Type | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:312 |
type
The name of the event (case-sensitive), e.g. "click", "fire", or "submit".
meta | description |
---|---|
Type | String |
Defined in | cocos2d/core/event/event.js:44 |
bubbles
Indicate whether the event bubbles up through the tree or not.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/event/event.js:52 |
target
A reference to the target to which the event was originally dispatched.
meta | description |
---|---|
Type | Object |
Defined in | cocos2d/core/event/event.js:60 |
currentTarget
A reference to the currently registered target for the event.
meta | description |
---|---|
Type | Object |
Defined in | cocos2d/core/event/event.js:68 |
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 | cocos2d/core/event/event.js:76 |
Methods
setScrollData
Sets scroll data.
meta | description |
---|---|
Defined in | cocos2d/core/event-manager/CCEvent.js:58 |
Parameters
getScrollX
Returns the x axis scroll value.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:70 |
getScrollY
Returns the y axis scroll value.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:80 |
setLocation
Sets cursor location.
meta | description |
---|---|
Defined in | cocos2d/core/event-manager/CCEvent.js:90 |
Parameters
getLocation
Returns cursor location.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/event-manager/CCEvent.js:102 |
getLocationInView
Returns the current cursor location in screen coordinates.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/event-manager/CCEvent.js:112 |
getPreviousLocation
Returns the previous touch location.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/event-manager/CCEvent.js:127 |
getDelta
Returns the delta distance from the previous location to current location.
meta | description |
---|---|
Returns | Vec2 |
Defined in | cocos2d/core/event-manager/CCEvent.js:137 |
getDeltaX
Returns the X axis delta distance from the previous location to current location.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:147 |
getDeltaY
Returns the Y axis delta distance from the previous location to current location.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:157 |
setButton
Sets mouse button.
meta | description |
---|---|
Defined in | cocos2d/core/event-manager/CCEvent.js:167 |
Parameters
button
Number
getButton
Returns mouse button.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:177 |
getLocationX
Returns location X axis data.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:187 |
getLocationY
Returns location Y axis data.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/event-manager/CCEvent.js:197 |
constructor
meta | description |
---|---|
Defined in | cocos2d/core/event/event.js:38 |
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 | cocos2d/core/event/event.js:111 |
reuse
Reuse the event for being used again by the object pool.
meta | description |
---|---|
Returns | String |
Defined in | cocos2d/core/event/event.js:126 |
stopPropagation
Stops propagation for current event.
meta | description |
---|---|
Defined in | cocos2d/core/event/event.js:137 |
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 | cocos2d/core/event/event.js:146 |
isStopped
Checks whether the event has been stopped.
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/event/event.js:156 |
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 | cocos2d/core/event/event.js:166 |
getType
Gets the event type.
meta | description |
---|---|
Returns | String |
Defined in | cocos2d/core/event/event.js:181 |