开发者

how use frequently an AS code without increase CPU usage?

开发者_如何转开发i have created an animation (kind of tween) in flash by AS,

i want to use it more than once in my project, but CPU usage increase very much!

i think save my animate as swf and load it in my project.

is good idea?

how do it?

can you suggest me efficient way?

thanks...


If your animation is 400 bricks and multiple rows, and I assume made in Flash as a vector MovieClip (i.e. not an image), then your CPU usage is coming from Flash having to draw a ton of vectors every frame. This becomes especially true when you start using multiple instances of it.

Take a look at cacheAsBitmap (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#cacheAsBitmap) if you're only moving your image around (not scaling or rotating it), or do as www0z0k suggested and draw it out as BitmapData objects.

You can also check out SWFSheet from bit101 - http://www.bit-101.com/blog/?s=swfsheet - it basically does the hard work for you by drawing out your animation as a series of PNG images that you can then load in


some code'd be useful.
but if you need to repeat exactly the same animation many times (and it's created at runtime) you can call BitmapData.draw() for each frame of animation when it's played for the first time and store that BitmapDatas in an Array or Vector to show them every next time instead of original animation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜