flash 屏幕更新
2010-06-02 15:50
148 查看
转自:http://chaimzane.javaeye.com/blog/320349
lash 中的屏幕更新主要分为两种:
1.scheduled update (主要)
2.post-event update
一。scheduled update
flash中的帧分为两种
a. Flash Player Frames
b. SWF Frames
swf 帧就是我们在使用Flash Ide是看到的时间线的帧,包括帧上的内容和帧上的代码
Flash Player帧的概念,是flash执行时的帧的概念,包括运行该swf帧上的代码和render 帧上的内容输出,和代码生成内容输出
下面的图呢过说明两者之间的关系:
其中 screenUpdate check() 中,判断为需要render 的条件 1. frame 中的内容被创建或修改 2.frame script 创建了新的 visual 内容 或修改 3.在等待期间,执行了list ener函数,并创建会修改 了 visual 内容 这里的屏幕render不会打断现有的代码执行而去执行一次 render ,她一定会在你所有的代码都执行完成后才会渲染。 二。Post-Event Screen Update 但是当一些visiual的东西的改变是由 mouse keyboard 来触发的,这样的话,还要等到屏幕render时才会显示 出变化,这会让程序看起来不是 很流畅。为了避免这样的问题,可以使用它,updateAfterEvent updateAfterEvent可以分为两种类型,一种是手动触发的,比如,MouseEvent的 event.updateAfterEvent,执行后,会出发屏幕的screenUpdate check(), 并立刻渲染相关内容,用到updateAfterEvent还有,keyDownListener的 event.updateAfterEvent,TimerEvent的event.updateAfterEvent。 还有一种是自动触发的,比如如下: 1.当鼠标移到/出,继承自 Sprite时自动触发 updateAfterEvent 2.按下/释放 鼠标左键(右撇子)时自动触发 updateAfterEvent 3.Using the spacebar or Enter key to activate an instance of a class that inherits from Sprite 三。Optimization with the Event.RENDER Event 当以下条件都为true时Flash runtime才会出发Event.RENDER, 1.The Flash runtime is about to check if the screen needs updating (whether due to a frame passing or an updateAfterEvent( ) call). 2.The programmer has invoked stage.invalidate( ). (stage.invalidate( ) is the programmer’s way of asking the Flash runtime to dispatch the Event.RENDER event the next time a screen-update check occurs). 就是当flash 即将要checkUpdate 的时候,包括scheduled update 触发的和Post-Event Screen Update触发的,还有个就是要 调用 stage。invalidate() 利用这用技术,我可以用Event.RENDER事件 来 优化程序,详见 Essential.ActionScript.3.0.pdf 463页。在Flex中的 a.callbackLater(),还有就是LayOutManger的机制也采用这用原理。有的人对 invalidateProperties(), invalidateSize(),invalidateDisplayList(),几个函数执行的原理和时间 不是很清楚,看完那个源代码很能会对你 有点帮助。。。
lash 中的屏幕更新主要分为两种:
1.scheduled update (主要)
2.post-event update
一。scheduled update
flash中的帧分为两种
a. Flash Player Frames
b. SWF Frames
swf 帧就是我们在使用Flash Ide是看到的时间线的帧,包括帧上的内容和帧上的代码
Flash Player帧的概念,是flash执行时的帧的概念,包括运行该swf帧上的代码和render 帧上的内容输出,和代码生成内容输出
下面的图呢过说明两者之间的关系:
其中 screenUpdate check() 中,判断为需要render 的条件 1. frame 中的内容被创建或修改 2.frame script 创建了新的 visual 内容 或修改 3.在等待期间,执行了list ener函数,并创建会修改 了 visual 内容 这里的屏幕render不会打断现有的代码执行而去执行一次 render ,她一定会在你所有的代码都执行完成后才会渲染。 二。Post-Event Screen Update 但是当一些visiual的东西的改变是由 mouse keyboard 来触发的,这样的话,还要等到屏幕render时才会显示 出变化,这会让程序看起来不是 很流畅。为了避免这样的问题,可以使用它,updateAfterEvent updateAfterEvent可以分为两种类型,一种是手动触发的,比如,MouseEvent的 event.updateAfterEvent,执行后,会出发屏幕的screenUpdate check(), 并立刻渲染相关内容,用到updateAfterEvent还有,keyDownListener的 event.updateAfterEvent,TimerEvent的event.updateAfterEvent。 还有一种是自动触发的,比如如下: 1.当鼠标移到/出,继承自 Sprite时自动触发 updateAfterEvent 2.按下/释放 鼠标左键(右撇子)时自动触发 updateAfterEvent 3.Using the spacebar or Enter key to activate an instance of a class that inherits from Sprite 三。Optimization with the Event.RENDER Event 当以下条件都为true时Flash runtime才会出发Event.RENDER, 1.The Flash runtime is about to check if the screen needs updating (whether due to a frame passing or an updateAfterEvent( ) call). 2.The programmer has invoked stage.invalidate( ). (stage.invalidate( ) is the programmer’s way of asking the Flash runtime to dispatch the Event.RENDER event the next time a screen-update check occurs). 就是当flash 即将要checkUpdate 的时候,包括scheduled update 触发的和Post-Event Screen Update触发的,还有个就是要 调用 stage。invalidate() 利用这用技术,我可以用Event.RENDER事件 来 优化程序,详见 Essential.ActionScript.3.0.pdf 463页。在Flex中的 a.callbackLater(),还有就是LayOutManger的机制也采用这用原理。有的人对 invalidateProperties(), invalidateSize(),invalidateDisplayList(),几个函数执行的原理和时间 不是很清楚,看完那个源代码很能会对你 有点帮助。。。
相关文章推荐
- 使用 Event.RENDER 优化 Flash 的屏幕更新
- flash 屏幕更新 -------- Essential.ActionScript
- flash获得用户屏幕的分辨率
- Flash Builder "Burrito" 的新功能开发移动和多屏幕应用程序,
- 更新屏幕界面字段
- 在java中使用amcharts可动态更新的flash统计图
- Android 设定横屏,禁止屏幕旋转,Activity重置 [更新视频播放器相关]
- ecshop 更新首页flash样式
- flash位图技术研究篇(4): flash舞台屏幕录制
- Linux Firefox Adobe Flash Player 安装和更新
- 小议DBAU1200 Development Board的Boot Flash更新
- 导致flash屏幕重绘的几种方式及避免重绘的方法
- Android中Listview的getChildAt()只能更新当前显示在屏幕上的Item的解决办法
- flash版本更新导致shopex后台上传图片无效的问题
- 解决listview更新数据时,屏幕闪烁的问题
- 使flash不保存在IE缓存中!实时更新
- iOS开发UI篇--屏幕适配思维导图[不断更新]
- WIN10 困扰多时的屏幕亮度 终于可以调节了-完美 -更新2018年2月28日
- 固件远程更新之STARTUPE2原语(fpga控制flash)
- flash纯动态生成饼图[2007-3-14更新增加xml配置文件,可下载(转)