Event.EventCustom 类型
继承于 Event
自定义事件
索引
属性(properties)
- detail- Object事件的详细数据
- keyCode- NumberkeyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。
- type- String事件类型。
- bubbles- Boolean表示该事件是否进行冒泡。
- target- Object最初事件触发的目标
- currentTarget- Object当前目标
- eventPhase- Number事件阶段
方法
- constructor
- setUserData设置用户数据
- getUserData获取用户数据
- getEventName获取事件名称
- unuse重置对象池中存储的事件。
- reuse用于对象池再次使用的事件。
- stopPropagation停止传递当前事件。
- stopPropagationImmediate立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
- isStopped检查该事件是否已经停止传递.
- getCurrentTarget获取当前目标节点
- getType获取事件类型
Details
属性(properties)
detail
事件的详细数据
| meta | description | 
|---|---|
| 类型 | Object | 
| 定义于 | cocos2d/core/event/event.js:291 | 
keyCode
keyCode 是只读属性它表示一个系统和依赖于实现的数字代码,可以识别按键的未修改值。</br> 这通常是十进制 ASCII (RFC20) 或者 Windows 1252 代码,所对应的密钥。</br> 如果无法识别该键,则该值为 0。
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/core/event/event.js:333 | 
type
事件类型。
| meta | description | 
|---|---|
| 类型 | String | 
| 定义于 | cocos2d/core/event/event.js:44 | 
bubbles
表示该事件是否进行冒泡。
| meta | description | 
|---|---|
| 类型 | Boolean | 
| 定义于 | cocos2d/core/event/event.js:52 | 
target
最初事件触发的目标
| meta | description | 
|---|---|
| 类型 | Object | 
| 定义于 | cocos2d/core/event/event.js:60 | 
currentTarget
当前目标
| meta | description | 
|---|---|
| 类型 | Object | 
| 定义于 | cocos2d/core/event/event.js:68 | 
eventPhase
事件阶段
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/core/event/event.js:76 | 
方法
constructor
| meta | description | 
|---|---|
| 定义于 | cocos2d/core/event/event.js:283 | 
参数列表
- 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
设置用户数据
| meta | description | 
|---|---|
| 定义于 | cocos2d/core/event/event.js:304 | 
参数列表
- dataAny
getUserData
获取用户数据
| meta | description | 
|---|---|
| 返回 | Any | 
| 定义于 | cocos2d/core/event/event.js:314 | 
getEventName
获取事件名称
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | cocos2d/core/event/event.js:324 | 
unuse
重置对象池中存储的事件。
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | cocos2d/core/event/event.js:111 | 
reuse
用于对象池再次使用的事件。
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | cocos2d/core/event/event.js:126 | 
stopPropagation
停止传递当前事件。
| meta | description | 
|---|---|
| 定义于 | cocos2d/core/event/event.js:137 | 
stopPropagationImmediate
立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
| meta | description | 
|---|---|
| 定义于 | cocos2d/core/event/event.js:146 | 
isStopped
检查该事件是否已经停止传递.
| meta | description | 
|---|---|
| 返回 | Boolean | 
| 定义于 | cocos2d/core/event/event.js:156 | 
getCurrentTarget
获取当前目标节点
| meta | description | 
|---|---|
| 返回 | Node | 
| 定义于 | cocos2d/core/event/event.js:166 | 
getType
获取事件类型
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | cocos2d/core/event/event.js:181 | 
