0
votes

Hey everyone so I am Using Flash Develop and I have Multiple Move clips added to the stage. Each of course has their own class. Now I have them set up in their class to move across the stage in a Linear motion using a ENTER_FRAME event and coding like so this.x += 10 However these Movie clips each have a frame by frame animation. So I was wondering by adding this.cacheAsBitmap = true; inside the Movie clip objects Class if it would help with the performance or since they have multiple frames if Adobe AIR would have to redraw those frames and cache them as bitmaps hence causing further performance issues. From what Ive read this.cacheAsBitmap = true; will help with performance that way the stage wont have to redraw the movie clip each FPS but has some draw backs like so "You should use cacheAsBitmap only in situation where your vector graphic will remain the same or will have its x or y properties updated."

Any help will be appreciated thanks guys.

1
Think I might have found the answer with further research from an article posted by Adobe.com Enabling cacheAsBitmap is always beneficial even when changing the scale, skew, alpha and/or rotation (but not changing a movie clip's frames) of a DisplayObject when publishing for mobile devices. - Nathan
You are making a lot of assumption as to why your game lags on mobile, that's the wrong way to go and fix the issue. To fix anything you need to KNOW what's causing the problem not guess it. Too many object on screen, too many timers/enterframes at once, using vector graphics, etc ... You need to start monitoring the app FPS and connect what's on screen to any drop of FPS. - BotMaster
I understand. I implemented netStat hires to track all of that. The thing is the FPS stay at a constant rate always over my 26 FPS or exactly at 26 FPS. One thing I do notice is the Memory increases rather fast but then goes back down from time to time. I checked everything as well in adobe scout and nothing out of the ordinary happens no spikes not decrease in FPS. The ONLY thing that is going on right now that I just cant figure out is when I test the game on my Android Mobile device the screen freezes for half a second every 2 seconds. I am going crazy. - Nathan
I think it is do to the GC being called frequently But idk. Ill probably just post a new question soon. - Nathan
The GC uses CPU to perform its tasks so if it's part of the problem then drop of fps would occur. - BotMaster

1 Answers

0
votes

You basically got it. cacheAsBitmap won't help (and it will probably hurt) with a frame-by-frame animation.

Using cacheAsBitmap is really only helpful by itself if you are only changing the x,y properties.

Using cacheAsBitmapMatrix (only available in AIR) will let the Flash Player apply transforms (scale, rotation, alpha) with the cached bitmap.

In either case, a frame-by-frame animation is going to force a redraw, which negates the value of both.

As a final note, if you really want to optimize your animation you can try converting it to a sprite sheet.