flash_game_optimization

flash_game_optimization

ID:33580017

大小:2.80 MB

页数:33页

时间:2019-02-27

flash_game_optimization_第1页
flash_game_optimization_第2页
flash_game_optimization_第3页
flash_game_optimization_第4页
flash_game_optimization_第5页
资源描述:

《flash_game_optimization》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Flash游戏优化技巧黄竣平台技术经理junhuang@adobe.comwww.fans8.com©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.2SmoothingGamePlay=BetterGame©2010AdobeSystemsIncorporated.AllRightsReserv

2、ed.AdobeConfidential.3©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.4帧频CPU内存©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.5代码优化帧频不够?图像优化CPU消耗太高?内存优化内存占用过多?显示优化⋯⋯©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeCo

3、nfidential.6Flash游戏中ActionScript代码优化©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.7Flash游戏中的ActionScript代码优化脚本运行速度的检测充分运用FlashPlayer新功能•Vector类与Array类varstarted:Number=getTimer();•新的绘图API……执行代码•处理像素的新方法……varrunTime=getTimer()-started;•事

4、件捕获和冒泡•其他©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.8Flash游戏中的ActionScript代码优化•Vector类与Array类FlashPlayer10引入了Vector类,其读写访问速度比Array类更快varcoordinates:Vector.varcoordinates:Array=newArray();=newVector.();varstarted:Numbe

5、r=getTimer();varstarted:Number=getTimer();for(vari:int=0;i<300000;i++)for(vari:int=0;i<300000;i++){{coordinates[i]=coordinates[i]=Math.random()*1024;Math.random()*1024;}}trace(getTimer()-started);trace(getTimer()-started);//output:107//output:72尽可能尝试使用Vect

6、or对象API,因为它们的运行速度可能更快©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.9Flash游戏中的ActionScript代码优化•新的绘图APIFlashPlayer10提供了一个新的绘图API,使用它可获得更好的代码执行性能。此新绘图API包含下列方法:•drawPath()•drawGraphicsData()•drawTriangles()此新的API不提供显示性能改进,但可以大大减少必须编写的代码行数。

7、代码行越少,ActionScript执行性能越好。©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.10Flash游戏中的ActionScript代码优化•处理像素的新方法FlashPlayer10中引入的了快速绘制及读取像素的方式•setVector()•getVector()•如果使用setPixel()或setPixel32(),请使用lock()和unlock()•减少遍历像素的次数•配合Vector类来提高像素处理速

8、度©2010AdobeSystemsIncorporated.AllRightsReserved.AdobeConfidential.11Flash游戏中的ActionScript代码优化•事件捕获和冒泡ActionScript3.0中的事件模型引入了事件捕获和事件冒泡的概念。for(vari:int=0;i

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
相关文章
更多
相关标签