文章说明:为了方便我自己查找easeljs的所有事件,所以我从easeljs的文档里抄过来加上自己的翻译,会慢慢补全,漏了的,错了的,评论一下我会补上去哦。(不确定翻译对不对的地方我会留着原文。)

  1. 继承自,表示所有继承自那个对象的对象都有这个事件。
  2. 定义于,表示只有这个对象才有这个事件。
  3. 加入版本,表示从这个版本起才加入这个事件,老版本没有这个事件。
  4. “此对象”表示被添加了这个事件的对象
  5. 与jquery和js一致,事件的回调函数第一个参数会带上事件对象,在easeljs文档event类中可以看到各个事件属性的说明。
  6. stage的事件全加进来了

easeljs事件默认是不支持touch设备的,需要这样才可以

var stage = new createjs.Stage("canvasId");
createjs.Touch.enable(stage);

添加事件的方法

on ( type listener [scope] [once=false] [data] [useCapture=false] ) Function

继承自 EventDispatcher
A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener only run once, associate arbitrary data with the listener, and remove the listener.
This method works by creating an anonymous wrapper function and subscribing it with addEventListener. The wrapper function is returned for use with removeEventListener (or off).
IMPORTANT: To remove a listener added with on, you must pass in the returned wrapper function as the listener, or use remove. Likewise, each time you call on a NEW wrapper function is subscribed, so multiple calls to on with the same params will create multiple listeners.
Example

var listener = myBtn.on("click", handleClick, null, false, {count:3});
function handleClick(evt, data) {data.count -= 1;console.log(this == myBtn); // true - scope defaults to the dispatcherif (data.count == 0) {alert("clicked 3 times!");myBtn.off("click", listener);// alternately: evt.remove();}
}

Parameters:

type String
The string type of the event.
listener Function | Object
An object with a handleEvent method, or a function that will be called when the event is dispatched.
[scope] Object optional
The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).
[once=false] Boolean optional
If true, the listener will remove itself after the first time it is triggered.
[data] optional
Arbitrary data that will be included as the second parameter when the listener is called.
[useCapture=false] Boolean optional
For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
Returns:

Function: Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.

added

继承自 DisplayObject
当此对象被add到其它容器对象时触发

click

继承自 DisplayObject
加入版本 0.6.0
在用户按下左键并在此对象上松开左键后触发。

dblclick

继承自 DisplayObject
加入版本 0.6.0
当用户在此对象上双击左键后触发。

drawend

定义于 stage
加入版本 0.7.0
每次显示列表被绘制到canvas后并且restore过canvas context后触发。
Dispatched each update immediately after the display list is drawn to the canvas and the canvas context is restored.

drawstart

定义于 stage
加入版本 0.7.0
在清除画布和绘制显示列表之前触发。可以在调用event对象上使用preventDefault取消这次绘制。
Dispatched each update immediately before the canvas is cleared and the display list is drawn to it. You can call preventDefault on the event object to cancel the draw.

mousedown

继承自 DisplayObject
加入版本 0.6.0
用户在此对象上按下左键后触发。

mouseenter

定义于 stage
加入版本 0.7.0
当鼠标指针从canvas区域外(mouseInBounds == true)移进canvas区域(mouseInBounds == false)后触发。这是目前唯一非点击的鼠标输入事件。

mouseleave

定义于 stage
加入版本 0.7.0
当鼠标从canvas区域内(mouseInBounds == true)移出(mouseInBounds == false)后触发。这是目前唯一非点击的鼠标输入事件。(我也不知道为何这里的mouseInBounds和上面的相反,看原文吧)

mouseout

继承自 DisplayObject
加入版本 0.6.0
当用户鼠标从该对象的任意一个子项离开后触发。这个事件一定要启用enableMouseOver。另请参阅rollout。(写好rollout后如果我还记得这里,会把这个链接弄好)

mouseover

继承自 DisplayObject
加入版本 0.6.0
当用户鼠标进入该对象的任意一个子项后触发。这个事件一定要启用enableMouseOver。另请参阅rollout。(写好rollout后如果我还记得这里,会把这个链接弄好)

pressmove

继承自 DisplayObject
加入版本 0.7.0
在此对象上发生了mousedown事件后,无论鼠标是否移动,pressmove事件都会持续发生在此对象上,直到松开鼠标按钮。这事件在拖拽和类似的需求里很有用。
(如果stage上加了这个事件侦听,当stage上什么元素都没有时,这个是无效的,需要用stagemousemove

pressup

继承自 DisplayObject
加入版本 0.7.0
在此对象上发生了mousedown事件后,松开鼠标会触发。这事件在拖拽和类似的需求里很有用。

removed

继承自 DisplayObject
当此对象从它的父对象上移除后会触发。

rollout

继承自 DisplayObject
加入版本 0.7.0
这个事件和mouseout很像,但有这些不同:它不冒泡,而且它把该对象的内容认为是一个整体。
例如,myContainer包含着两个有重叠部分的子项:shapeAshapeB。用户移动他的鼠标到shapeA上,然后直接移到shapeB上,然后离开他们俩。如果myContainerMouseout:event,会收到两个事件,每个事件指向一个子元素:

  • 当鼠标离开shapeAtarget=shapeA
  • 当鼠标离开shapeBtarget=shapeB

然而当事件换成rollout,只会在离开myContainer时才会触发事件(不仅仅是离开shapeB),target=myContainer。这个事件一定要启用enableMouseOver
(jquery也有这样的,但是我忘记jquery中哪个是只离开父对象才触发了。)

rollover

继承自 DisplayObject
加入版本 0.7.0
这个事件和mouseover很像,不同之处跟rolloutmouseout的不同之处是一样的。这个事件一定要启用enableMouseOver

stagemousedown

定义于 stage
加入版本 0.6.0
用户在canvas上按下左键后触发。

stagemousemove

定义于 stage
加入版本 0.6.0
当用户在canvas上移动鼠标时持续触发。

stagemouseup

定义于 stage
加入版本 0.6.0
当用户在stage的某处按下左键,然后在页面中能接收事件的任意一处(不同浏览器有些不同)松开左键。可以使用mouseInBounds检查鼠标是否在stage范围内。

tick

继承自 DisplayObject: tick:642
加入版本 0.6.0
Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the rendering (draw) pass. When update is called, first all display objects on the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their Tick:event event dispatched in order of their depth prior to the event being dispatched on their parent.
Event Payload:

  • target Object

The object that dispatched the event.

  • type String

The event type.

  • params Array

An array containing any arguments that were passed to the Stage.update() method. For example if you called stage.update("hello"), then the params would be ["hello"].

  • paused Boolean
    指出ticker当前是否暂停
  • delta Number

从上次触发事件以来,经过了多少毫秒。

  • time Number

Ticker实例化之后经过了多少毫秒

  • runTime Number

Ticker实例化之后未被暂停的状态下经过了多少毫秒。例如,你可以决定用time-runTime初始化后被暂停的总时间(The total time in ms that Ticker was not paused since it was initialized. For example, you could determine the amount of time that the Ticker has been paused since initialization with time-runTime.)

tickend

Defined in tickend:294
Available since 0.7.0
Dispatched each update immediately after the tick event is propagated through the display list. Does not fire if tickOnUpdate is false. Precedes the "drawstart" event.

tickstart

Defined in tickstart:287
Available since 0.7.0
Dispatched each update immediately before the tick event is propagated through the display list. You can call preventDefault on the event object to cancel propagating the tick event.

【easeljs】事件汇总相关推荐

  1. oracle gc chain,ORACLE GC 类等待事件汇总分析

    ORACLE GC 类等待事件汇总分析 作者简介: ---------------------------------------------------------------------- @ 孙 ...

  2. vue3-video-play视频组件的使用(一)——基本使用 HTML5中Video标签的属性、方法和事件汇总

    vue3-video-play视频组件的使用(一)--基本使用 & HTML5中Video标签的属性.方法和事件汇总 npm地址:https://www.npmjs.com/package/v ...

  3. JS事件汇总,addEventListener添加事件监听

    JS事件汇总 JavaScript 事件 JS事件汇总 鼠标事件 键盘事件 表单事件 读取事件 onload与onpageshow事件区别 其它事件 addEventListener()添加事件监听 ...

  4. EaselJS 事件

    EaselJS 事件类型 1.click 鼠标单击事件 2.dbClick 鼠标双击事件 3.mousedown 鼠标按下事件 4.mouseover 鼠标移过事件 5.mouseout 鼠标移出事件 ...

  5. 移动端H5 input移动端事件汇总

    移动端H5 input事件汇总 这里汇总了Android和IOS端的input事件汇总 Android 端的H5 input事件 1. focus事件 2. input事件 3. keydown事件 ...

  6. Javascript事件汇总

    Javascript事件汇总 事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture ...

  7. 9月13号魔兽服务器维护,魔兽世界9月13号重点事件汇总 魔兽世界下周要点一览...

    魔兽世界9月13号重点事件汇总 魔兽世界下周要点一览 2018-09-12 15:08:44来源:游戏下载编辑:野狐禅评论(0) <魔兽世界8.0>下周(9.13-9.19)即将迎来M奥迪 ...

  8. html button onclick 列表,HTML Button.onclick 事件汇总

    HTML Button.onclick 事件汇总 οnclick="document.all.WebBrowser.ExecWB( 1,1)" type="button& ...

  9. input标签的事件汇总

    我在做一个注册时用到了,在网上查的,比较碎.就汇总了下, 1.onfocus  当input 获取到焦点时触发 2.onblur  当input失去焦点时触发,注意:这个事件触发的前提是已经获取了焦点 ...

最新文章

  1. Http协议中的数据传送之多重表单提交--multipart/form-data
  2. FTP的主动模式(PORT Mode)及被动模式(Passive Mode)
  3. 百万级数据库优化方案[转载]
  4. C++中string.find()的误用
  5. 外媒:iPhone 14全系有望配备120Hz ProMotion显示屏
  6. JMeter使用命令行模式生成HTML测试报告
  7. java中数组的返回值是什么类型_java基础学习:数组的常用操作与基础二维数组用法、及基本数据类型和引用数据类型赋值的区别...
  8. 动态时间规整算法(DTW)通俗易懂
  9. Java Scheduler ScheduledExecutorService ScheduledThreadPoolExecutor示例
  10. 牛客网–华为机试在线训练5:进制转换
  11. Bash:把粘贴板上的内容拷贝的文件中。
  12. Android性能优化最佳实践,分享一点面试小经验
  13. 微博这样的软件怎么测试,新浪微博都盘上了,这个测试玩嗨了!
  14. 火遍全球的光伏热!2021上半年全球光伏投资789亿美元,A股第十家千亿市值光伏企业昨日诞生!
  15. 一文掌握有序logistic回归分析
  16. 算法复杂度分析,算法复杂度o(1), o(n), o(logn), o(nlogn) 时间复杂度On和空间复杂度O1是什么意思?
  17. 语法练习——动名词专项训练
  18. 中国国家地理高清晰的PDF书籍系列经典珍藏版
  19. 函数的使用:两个数取最小值
  20. 非常好用的一款在线甘特图工具

热门文章

  1. python年龄计算器_使用python的while语句,编写简单门票与年龄计算器
  2. 最长上升子序列(acwing 895 acwing 896 acwing1017)
  3. 零基础入门语音识别-食物声音识别[Task 3]
  4. leecode01俩数之和
  5. 三秒绘画!我的AI绘画之旅——Adobe体验
  6. 【猫优壁纸】uniapp后端安装教程
  7. 用友nc65 uap开发如何将一个vo单据显示在一个弹窗面板上?
  8. bzoj2393 Cirno的完美算数教室
  9. 设置Ubuntu全屏
  10. springboot:接手老项目,领导让更新数据库说明文档,如何3分钟完成任务