Writing The Component's Actionscript Code - MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual

Developing flex components and themes in flash authoring
Table of Contents

Advertisement

The process of creating a Flex component in Flash is different from the one for creating general-use
Flash components. It is possible, and even desirable, to create components that operate in both
environments; however, there are certain optimizations available to Flex applications that require
that components behave in a more sophisticated manner.
Flex components are different from Flash components in that Flex does not expose the Timeline,
which means that the infrastructure can have more control over how components are instantiated.
In addition, Flex does not have a Stage with objects.
Use the following general process for creating a new Flex component in Flash:
Create a symbol and add assets in the FLA file.
1.
Insert a new symbol onto the Flash Stage and convert it to a component.
a
Add dependent components to the new symbol.
b
Create an ActionScript class file.
2.
Extend one of the base classes (UIObject or UIComponent) or another component.
a
Specify
b
symbolName
Specify properties that can be set using an MXML tag property (clip parameters).
c
Implement the
d
Implement the
e
Implement the
f
Implement the
g
Implement the
h
Implement the
i
Add properties, methods, and metadata.
j
Link the class file to the FLA file.
3.
Generate a SWC file.
4.

Writing the component's ActionScript code

Most components include some ActionScript code. When you create a component symbol that
derives from a parent class, you link the symbol to an external ActionScript 2.0 class file. (For
information on defining this file, see
The external ActionScript class extends another class, adds methods, adds getters and setters, and
defines events and event handlers for the component. When you extend an existing component
class, you can inherit from only one class. ActionScript 2.0 does not allow multiple inheritance.
To edit ActionScript class files, you can use Flash, any text editor, or an Integrated Development
Environment (IDE).
46
Chapter 3: Creating Advanced Components in Flash MX 2004
,
, and
symbolOwner
constructObject2()
method.
init()
method.
createChildren()
method.
measure()
method.
layoutChildren()
method.
draw()
"Working with component symbols" on page
.
className
method.
12.)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents