I am developing a game for the Android platform using flash cs5 and AS3.
problem: the game will run at 24-29 fps until I call a movieClip that has frame by frame animation, then it will drop to 10-14 FPS. It looks perfect on my PC and does not lose frames until I move it to my Evo for test开发者_JS百科ing. I have tested on an Epic also and I do not lose Frames which leads me to believe that it is the pixil population in the evo that is causing the problem but I have tried everything I can think of to not make it so intense on the graphics but same results every time.
It's a 20 frame animation and my FPS in flash is set to 24
What I have tried:
png's on each frame | gif's on each frame | pen tool vector drawing of each image on each frame | tween instead of frame by frame | static image in the movie clip and creating a loop in AS3 that will cycle through the images | onEnterFrame |
The only thing that actually does make it smooth is having the same image on each frame. This is why I believe it is the graphics and not the processor.
**Benchmark on PC :**
FPS: 24/24
FPS DURING ANIMATION: 24/24
MS: 33
MS DURING ANIMATION: 33
MEMORY: 18.87
MEMORY DURING ANIMATION: 19.27
**Benchmark on Evo :**
FPS: 24/24
FPS DURING ANIMATION: 13/24
MS: 36
MS DURING ANIMATION: 80
MEMORY: 2.931
MEMORY DURING ANIMATION: 2.993
Do not use vector: it's terrible. What you need to do is use the cacheAsBitmapMatrix method, but this is available only if you're publishing using the AIR for android publish settings.
http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/display/DisplayObject.html#cacheAsBitmap
Also a video tutorial about taking advantage of GPU acceleration on mobile/android that walks you through benchmarks and implementation:
http://gotoandlearn.com/play.php?id=132
And as a last update to the answer, here is a great article comparing all these methods of drawing on the android platform + benchmarks:
http://labs.byhook.com/2011/01/13/digital-sheep-air-for-android-drawing-performance/
It discusses at length the different implementations and why some are better/worse than others.
精彩评论