Optimizing Actionscript Performance - MACROMEDIA FLASH 8-DEVELOPING FLASH LITE 2.X Develop Manual

Developing flash lite 2.x applications
Hide thumbs Also See for FLASH 8-DEVELOPING FLASH LITE 2.X:
Table of Contents

Advertisement

Optimizing ActionScript performance

Because of the processing speed and memory limitations on most mobile devices, use the
following guidelines when you develop ActionScript for Flash Lite content used on mobile
phones:
Keep the ActionScript as simple as possible.
Limit the number of loops that you use and the amount of code that each loop contains.
Stop frame-based looping as soon as it is no longer needed.
When possible, avoid string and array processing because it can be CPU-intensive.
Always try to access properties directly rather than using ActionScript getter and setter
methods, which have more overhead than other method calls.
Manage events wisely and specifically. Keep your event listener arrays compacted by using
conditions to check whether a listener exists (is not
Delete variables or set them to
data for garbage collection. Deleting variables helps optimize memory use during runtime,
because unneeded assets are removed from the SWF file. It is better to delete variables
than to set them to
For more information on garbage collection and memory management techniques, see
"Managing application memory" on page
Explicitly remove listeners from objects by calling
collection.
If you are dynamically calling a function and passing a fixed set of parameters, use
instead of
apply()
Make your namespaces (such as paths) more compact to save startup time. Every level in
the package is compiled to an
fewer levels in the path saves time.
For example, a path with the levels
an object to be instantiated for
use preprocessor software to reduce the path to a unique identifier, such as
58923409876.functionName()
If your application consists of multiple SWF files that use the same ActionScript classes,
you can exclude those classes from select SWF files during compilation. This can help
reduce application download time and runtime memory requirements. For more
information, see
"Excluding classes from compilation" on page
Avoid using
Object.watch()
property requires the player to determine whether a change notification must be sent.
76
Optimizing Content for Performance and Memory
when you no longer need them. Doing this marks the
null
.
null
.
statement and causes a new
IF
com.xxx.yyy.aaa.bbb.ccc.functionName()
,
com
xxx
, before compiling the SWF.
and
Object.unwatch()
) before calling it.
null
77.
removeListener()
,
,
,
, and
yyy
aaa
bbb
ccc
, since every change to an object
before garbage
call()
call, so having
Object()
. Some Flash developers
79.
causes

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-DEVELOPING FLASH LITE 2.X and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents