Flash is capable of performing an impressive number of tasks and delivering such a wide variety of different types of information that it can be tricky to know where to start when trying to reign in a bloated application. In an effort to keep a large and still growing Flash application that I am developing under control, I recently did some research into Flash optimization. So, after some experimentation and a little searching around online, I was able to put together a list of tips, the best of which Ill share with you now. Some of these tips relate to graphics, most however, focus on the nitty-gritty of ActionScript and so are a little technical in nature.

1. Try not to scale images as this can be quite a CPU intensive operation.

2. Avoid using outlines around vector images, this also adds to CPU load without necessarily improving the quality of the vector.

3. Avoid using _alpha and gradients if possible. If you have an object thats going to be at 0 _alpha for a while, set '_visible = 0' instead.

4. Keep all your code centralized, because code lookups dont have to go through MCs. It also makes your SWFs far more intelligible if your code isnt hidden within a multitude of different MCs.

5. Reuse code where possible and practical. Try and avoid repeating routines where a single function might suffice.

6. Avoid unnecessary variable declaration. ActionScript is an interpreted language and variables take up more space than in compiled languages.

7. Use 'var' to declare variables. Local variables are faster to access for the player and are destroyed when the function returns.

8. When declaring variables, try and avoid long variable names, e.g. 'var thisisacrazylengthforavariablename = 1' is a lot slower than 'var shorter = 1'.

9. When declaring variables it is better to use 'var a=b=c=0' rather than:
'var a=0
var b=0
var c=0'

10. Defining things like parent in MC's as a local variable, e.g. 'var p=_parent', reduces the time taken for looking it up. Likewise, storing built in functions in vars can speed things up, e.g. 'var Mpi=Math.PI' , and precalculating whenever you can, e.g. 'var rad=Mpi/180'.

11. When using arrays, it's better to specify the initial size and make it sufficient for your needs. Otherwise flash will be resizing the array which wastes CPU power.

12. Avoid using multi-dimensional arrays, if a single dimension can be used instead.

13. Try not to operate on long strings, where possible, split the strings up.

14. 16000 is Flashs magic number. This number represents the upper limit for the number frames, layers, symbol instances and loaded movie clips within a given movie. Exceed this value, and Flash will start to act strange.

15. The supplied V2 components are large, inefficient and difficult to customize. If components are going to form the backbone of an application and will need to be customized, it may be worth investing in a third party solution.

16. A useful tool in battle with the bloat, is Flashs inbuilt size report. In the publish settings select the generate size report feature and review the output to see how the different parts of your SWF are contributing to file size.

These are just a few of the vast number of things that can be done to keep your Flash SWFs trim, and indeed may not be the best choice in all circumstances, but theyre a handy starting point nonetheless. A lot of the above tips were culled from the various resources catalogued at Lessrain blog; a site which is worth checking out for some further reading.

Your request has been submitted and a rep will reach out to you shortly.

Message Sent

Thank you for your interest.

Thank you for registering.

You should receive a confirmation email from GoToWebinar with your unique webinar login information. If you do not receive this email or have trouble logging in to the event, please email asmaa.mourad@cardinalpath.com.

Thank you for subscribing!

You're now looped into the world's largest GMP resource hub!

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.
Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Thank you for submitting the form.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Message Sent

Success! Thank you
for reaching out.