Event.EventCustom Class
Extends Event
Module: cc
The Custom event
Index
Properties
- detail- ObjectA reference to the detailed data of the event
- keyCode- NumberThe keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key. </br> This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.</br> If the key can't be identified, this value is 0.</br>
- type- StringThe name of the event (case-sensitive), e.g. "click", "fire", or "submit".
- bubbles- BooleanIndicate whether the event bubbles up through the tree or not.
- target- ObjectA reference to the target to which the event was originally dispatched.
- currentTarget- ObjectA reference to the currently registered target for the event.
- eventPhase- NumberIndicates 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
- constructor
- setUserDataSets user data
- getUserDataGets user data
- getEventNameGets event name
- unuseReset the event for being stored in the object pool.
- reuseReuse the event for being used again by the object pool.
- stopPropagationStops propagation for current event.
- stopPropagationImmediateStops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.
- isStoppedChecks 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.
 </p>- It returns 0 when the listener is associated with fixed priority.
- getTypeGets the event type.
Details
Properties
detail
A reference to the detailed data of the event
| meta | description | 
|---|---|
| Type | Object | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:290 | 
keyCode
The keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key. </br> This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key.</br> If the key can't be identified, this value is 0.</br>
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:332 | 
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
constructor
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:282 | 
Parameters
- typeString The name of the event (case-sensitive), e.g. "click", "fire", or "submit"
- bubblesBoolean A boolean indicating whether the event bubbles up through the tree or not
setUserData
Sets user data
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:303 | 
Parameters
- dataAny
getUserData
Gets user data
| meta | description | 
|---|---|
| Returns | Any | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:313 | 
getEventName
Gets event name
| meta | description | 
|---|---|
| Returns | String | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:323 | 
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 | 
