FLASH CS3
User Guide
490
Deselect the Optimize for Flash Player 6r65 option in Publish Settings for the V2 UI components to work.
Optimizing component styles and performance
When using ActionScript 2.0, one of the most processor-intensive calls in a component framework is the
setStyle
call. The
setStyle
call executes efficiently, but the call is intensive because of the way it is implemented. The
setStyle
call is not always necessary in all applications, but if you use it, consider its performance effect.
To enhance performance, you can change styles before they are loaded, calculated, and applied to the objects in your
SWF file. If you can change styles before the styles are loaded and calculated, you do not have to call
setStyle
.
To improve performance when using styles, set properties on each object as objects are instantiated. When you
dynamically attach instances to the Stage, set properties in
initObj
in the call that you make to
createClas-
sObject()
, as the following ActionScript shows:
createClassObject(ComponentClass, "myInstance", 0, {styleName:"myStyle", color:0x99CCFF});
For instances that you place directly on the Stage, you can use
onClipEvent()
for each instance, or you can use
subclasses (recommended). For information on subclasses, see About writing a subclass in
Learning ActionScript 2.0
in Adobe Flash
.
If you must restyle your components, you can improve efficiency in your application by using the Loader component.
To implement several styles in different components, place each component in its own SWF file. If you change styles
on the Loader component and reload the SWF file, the components in the SWF file are recreated. When the
component is recreated, the cache of styles is emptied, and the style for the component is reset and referenced again.
Note:
To apply a single style to all instances of a component in your SWF file, change the style globally using
_global.styles.ComponentName
.
Using runtime shared libraries
You can sometimes improve download time by using runtime shared libraries. These libraries are usually necessary
for larger applications or when numerous applications on a site use the same components or symbols. By external-
izing the common assets of your SWF files, you do not download classes repeatedly. The first SWF file that uses a
shared library has a longer download time, because both the SWF file and the library load. The library caches on the
user’s computer, and then all the subsequent SWF files use the library. This process can greatly improve download
time for some larger applications.
Components
Flash Player 6
(6.0.65.0) and earlier
Flash Player 6
(6.0.65.0)
Flash Player 7 and 8
Flash Player 9
ActionScript 3.0
N
ot supported
N
ot supported
N
ot supported
Supported
ActionScript 2.0
Supported
Supported
Supported
Supported
V2 UI component set
N
ot supported
Supported
Supported
Supported
Media components
N
ot supported
N
ot supported
Supported
Supported
Data components
N
ot supported
N
ot supported
Supported
Supported