Flash optimization on mobile

4 Comments 16 April 2010

Flash optimization on mobile

Yesterday, I had the chance to speak at the FFK10 conference in Germany. Initially, Mark Doherty should have presented the session on “Best practices for mobile development with the Flash Platform“, but, due to administrative issues, he couldn’t make it. It was a kind of challenge to understand this wide topic. Fortunately, I’ve found a lot of significant resources:

– To understand how to optimize your flash code, the reference is the white paper written by Thibault Imbert ( I figured out, reading this public book, that the main issues are coming from the rendering engine of the Flash Player. You really need to optimize the graphical assets of your Flash applications. The good news, is that the optimization tricks are really easy to understand and apply to your existing code.

– This article on the Adobe Developer Connection portal really helped me to deeply understand the behavior of the new Flash Player 10.1, the one that will be embedded on smartphones:

– I also encourage you to follow the Slider project (Flex on mobile).

– Finally, I love the post of Christian Cantrell who developed a game that modify its layout regarding the size of the screen (which is a big challenge for mobile applications).

Here are some tips:

-One key to understanding how to improve application performance is to understand how the Flash Platform runtime executes code. The runtime operates in a loop with certain actions occurring each “frame.” A frame in this case issimply a block of time determined by the frame rate specified for the application. Keep SWF frame rate as low as possible. If necessary, set the frame rate of the Stage dynamically as needed. Avoid high-rate ActionScript timers; also avoid using many different timers in the same project. BTW, Flash Player 10.1 RC limits the FPS to 60.

– Another simple way to optimize memory is to reuse objects and avoid recreating them whenever possible.

– Even when removed from the display list, the movie clip still dispatches the Event.ENTER_FRAME event. The movie clip still runs, but it is not rendered. To handle this situation correctly, listen to the proper events and remove event listeners, to prevent CPU-intensive code from being executed, check my slides.

– Consider bitmaps versus vectors. I’ve shown to the audience a benchmark application that demonstrates the good usage of the cacheAsBitmap property. My advice is the following. If you manipulate graphical elements using the X and Y axis only, please set the cacheAsBitmap property to true. It will dramatically improve the performances of your applications. Transparency is very expensive, avoid the alpha channel, avoid filters and blend modes. If you use the rotation property, don’t use cacheAsBitmap, but the Draw sample detailed here:

Video: On most mobile phones, software decoding of H.264 will often be below 10 fps. In the set of devices that support GPU-based H.264 decoding, not all will support all H.264 profiles and features. Support may be limited to baseline profile, or main profile in limited screen resolutions (such as 640 × 480 and lower). Most mobile devices can decode only one H.264 stream at a time. Additional streams will be decoded in software and may play back with very low frame rates.

Here a link to the application I used to benchmark my bitmap on the Apple’s phone, and on the Google’s phone:
Finally, here are the slides I’ve presented at the FFK10 conference (thanks again to the FFK team for the warm welcome and the quality of the event, and thanks to Serge for bringing a mobile camera instead of having breakfast 😉 ):

Post to Twitter

Your Comments

4 Comments so far

  1. Dhaya says:

    Haha, i absolutely LOVE the 5th slide !


  1. What is the basics tools for on line page optimization.? | C M O Z - April 16, 2010

    […] Flash optimization on mobile | RIAgora […]

  2. PIA Blog / Productivity by Design » Notre revue de presse (21/04/2010) - April 21, 2010

    […] Riagora, fait un petit récapitulatif des différentes ressources disponibles sur le sujet. Consulter l’article  Usage transparent de l’accéléromètre sous Android et iPhoneVoici un autre article de […]

  3. FITC, day two « aloft - March 10, 2011

    […] it can be found too on Thibault’s blog and other places. So much reading to […]

Share your view

Post a comment

Who am I ?

I'm Michaël CHAIZE, Adobe Flash Platform Evangelist based in Paris. I'm a big fan of Rich Internet Applications and I promote the Flash Platform in the Enterprise world.
You can follow me on twitter:


Follow us on Facebook

© 2018 RIAgora. Powered by WordPress.

Daily Edition Theme by WooThemes - Premium WordPress Themes