![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Скачать руководство пользователя страница 46](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115046.webp)
46
Chapter 3: Creating Advanced Components in Flash MX 2004
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:
1.
Create a symbol and add assets in the FLA file.
a
Insert a new symbol onto the Flash Stage and convert it to a component.
b
Add dependent components to the new symbol.
2.
Create an ActionScript class file.
a
Extend one of the base classes (UIObject or UIComponent) or another component.
b
Specify
symbolName
,
symbolOwner
, and
className
.
c
Specify properties that can be set using an MXML tag property (clip parameters).
d
Implement the
constructObject2()
method.
e
Implement the
init()
method.
f
Implement the
createChildren()
method.
g
Implement the
measure()
method.
h
Implement the
layoutChildren()
method.
i
Implement the
draw()
method.
j
Add properties, methods, and metadata.
3.
Link the class file to the FLA file.
4.
Generate a SWC file.
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
“Working with component symbols” on page 12
.)
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).
Содержание FLEX - DEVELOPING COMPONENTS AND THEMES
Страница 1: ...Developing Flex Components and Themes in Flash Authoring ...
Страница 4: ...4 Contents ...
Страница 44: ...44 Chapter 2 Creating Basic Components in Flash MX 2004 ...
Страница 82: ...82 Index ...