Posts Tagged ‘performace’

Stage.quality vs performance

Friday, April 3rd, 2009

One of the worst problem that any developer have to face is the performance of his applications. There are many factor contributing to a bad performance, one of them is graphic rendering.

Depending of what you’re doing, there’s a single line of code that solves this problem.

stage.quality = StageQuality.LOW

When you set the stage quality as low, you tell flash to render all vectors without anti-alias. This increases the application performance a lot. However this can makes your application looks like a crap depending of how you built it. There is a few things you can do to balance performance and visual quality.

The first thing you can do is set your text alias as ADVANCED or if it’s a static text Anti-alias for readability.

This movie requires Flash Player 9

Another tip is use bitmaps instead of vectors. Of course you must choose wisely whose graphics need to have a good quality and the size of them. Also, you can change you image quality at the properties panel to get a smaller file. Although you need to be carefull with this, because your bitmaps wont smooth if you rotate or scale them.

I didn’t research why exactly bitmaps don’t mess up when the stage quality is set to low, but I think it is because flash don’t need to calculate what color every pixel when they are displayed, all colors are already defined by the bitmap data.

With this thought, I created a high quality container class, called HQContainer, that renders all children at the quality you want (low, medium, high, best).

I have a 1000 boxes rotating. 990 of them are blue and have .05 of opacity. 10 of them are red and have a MouseEvent listener added.


(more…)