日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

flash 屏幕更新

發(fā)布時間:2023/12/25 综合教程 33 生活家
生活随笔 收集整理的這篇文章主要介紹了 flash 屏幕更新 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

轉(zhuǎn)自: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是看到的時間線的幀,包括幀上的內(nèi)容和幀上的代碼
Flash Player幀的概念,是flash執(zhí)行時的幀的概念,包括運行該swf幀上的代碼和render 幀上的內(nèi)容輸出,和代碼生成內(nèi)容輸出

下面的圖呢過說明兩者之間的關(guān)系:

其中 screenUpdate check() 中,判斷為需要render 的條件 1. frame 中的內(nèi)容被創(chuàng)建或修改 2.frame script 創(chuàng)建了新的 visual 內(nèi)容 或修改 3.在等待期間,執(zhí)行了list ener函數(shù),并創(chuàng)建會修改 了 visual 內(nèi)容 這里的屏幕render不會打斷現(xiàn)有的代碼執(zhí)行而去執(zhí)行一次 render ,她一定會在你所有的代碼都執(zhí)行完成后才會渲染。 二。Post-Event Screen Update 但是當(dāng)一些visiual的東西的改變是由 mouse keyboard 來觸發(fā)的,這樣的話,還要等到屏幕render時才會顯示 出變化,這會讓程序看起來不是 很流暢。為了避免這樣的問題,可以使用它,updateAfterEvent updateAfterEvent可以分為兩種類型,一種是手動觸發(fā)的,比如,MouseEvent的 event.updateAfterEvent,執(zhí)行后,會出發(fā)屏幕的screenUpdate check(), 并立刻渲染相關(guān)內(nèi)容,用到updateAfterEvent還有,keyDownListener的 event.updateAfterEvent,TimerEvent的event.updateAfterEvent。 還有一種是自動觸發(fā)的,比如如下: 1.當(dāng)鼠標(biāo)移到/出,繼承自 Sprite時自動觸發(fā) updateAfterEvent 2.按下/釋放 鼠標(biāo)左鍵(右撇子)時自動觸發(fā) 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 當(dāng)以下條件都為true時Flash runtime才會出發(fā)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). 就是當(dāng)flash 即將要checkUpdate 的時候,包括scheduled update 觸發(fā)的和Post-Event Screen Update觸發(fā)的,還有個就是要 調(diào)用 stage。invalidate() 利用這用技術(shù),我可以用Event.RENDER事件 來 優(yōu)化程序,詳見 Essential.ActionScript.3.0.pdf 463頁。在Flex中的 a.callbackLater(),還有就是LayOutManger的機制也采用這用原理。有的人對 invalidateProperties(), invalidateSize(),invalidateDisplayList(),幾個函數(shù)執(zhí)行的原理和時間 不是很清楚,看完那個源代碼很能會對你 有點幫助。。。

總結(jié)

以上是生活随笔為你收集整理的flash 屏幕更新的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。