Important Points to Speedup your Adobe Flex/ActionScript Application
A] Reduce More Popup windows in application
B]Reduce Usage of Item Renderers
C]Dont use Unnecessarily Effects,Scroll bars,and Resizing
functionalities in your code
D]Use Garbage collector for Destroy Objects
E]Use Flex Validate/Invalidate Model
I]Use Update Component
II] Use sizing and Measure
III]Use Update Drawing and positioning
F]Avoid Usage of Nesting of containers
1]Reduce usage of Hbox,Vbox[Instead of Use VGroup,HGroup]
2]Don’t use Default Scroll bar it will take lot of time to render
3]Don,t use clipping for Default.
G]Expensive Actionscript Calls
1]Don’t Use setStyle() Property in Actionscript
[UseCreationComplete() function to assign Propertie]
2]Use CSS for instead of use setStyle() function.
3]Use Bitmap Image for Rendering Images in application
4]Use Vector Graphics it will draw very quickly
5]Don’t use Drop shadow in Objects in flex application
6]Use [new Dictionary(true) ] function for handle memory objects
H] Use Vector instead of Array [Vector more faster then array]
I]Use Small variables in length & general naming conventions[e.g sum]
G]Remove from the DisplayList() at the end of the application.
Some Explainations about Above topic:
1. Use the right type of art asset for the job
Use vector art for your simplest objects and png or jpg file types for the more complex graphics. Rendering and graphic related function calls are the most processor intensive routines; therefore, rendering is usually where you can make the most improvement. Check out an objects memory consumption by going to File -> publish settings -> flash tab -> generate size report to get a rough idea of which assets to change.
2. Cache appropriate objects
Cache your most expensive objects to render (set cacheAsBitmap property to true). Caching an object stores it in memory, and if it is static, you will only have to pay to render it once. Filter effects cause objects to be cached, if many of your objects have filters applied to them they could be the cause of a memory problem. If a cached object is animated, scaling, or rotating it will be re-cached for every one of those graphic manipulations which is a heavy burden for the processor.
3. Limit your art assets attached to the stage
No sense in traversing render nodes if they are not actively being used. If it is an object that is not frequently visible I will completely destroy it and recreate it when it is needed again. The archetype to employ this strategy is menu systems.
4. Disable events that you do not need
Dispatching events is one of the more expensive function calls that you can make. Every class that extends InteractiveObject (which encompasses every display object) generates a host of events that you most likely do not need. Take the time to set MouseEnabled and MouseChildren to false to keep your event system as clean as possible. Also, make sure to remove event listeners and onEnterFrame events when you no longer need them.
5. Avoid using masks
If you need to mask a square area use the display object’s ’scrollRect’ property instead. If you need a shape that is not a square, place that shape over the object with the scrollRect property.
6. Unnecessary operations and function calls
Instead of dividing, multiply. Instead of calling Flash’s math class for simple things like floor and round, calculate them yourself. Rank your if statements in order of comparisons most likely to be true. In for and while statements locally store function values instead of repeated accessing them and reuse objects if possible. Similar to promotion issues, individual calls are not worth worrying about, but there can be a big difference in loops iterated several hundred times.
7. Resolve issues of promotion, unknown, or incorrect object types
ActionScript can waste a lot of time determining the type of an object if it does not understand the object type, or if ActionScript has to cast an object type. Pay close attention the object types of function parameters and types functions return as these are typical problem sources. Individually, object type compatibility changes are not going to save you that much time. In most cases this is something that you would need to be doing thousands of times to see a sizable difference in performance.
8. Sprites and MovieClips
You only need to use the MovieClip type if the object has multiple frames, you can export for ActionScript Library objects extending the Sprite class instead of the MovieClip class.
9. Unnecessary import statements
Not the biggest time saver unless you are generating many instances of the class or the class has a large number of function calls made to it. However, it is a very easy way to improve performance.
10. Make sure your performance problem is not a memory problem
Debugging 101 is to correctly identify the source of your problem. If you are using up all of your available RAM with references to artwork or other memory intensive structures your processor will be crippled by having to retrieve and set data from slower memory. If your application slows over time it is most likely a memory leak issue were objects you intended to delete are still being stored. The other reason to check for this issue first is that it is very easy to see how much memory that you are using, Flash does everything for you, just call System.totalMemory. Easier still, just bring up the task manager and consult your page file usage.