Instantiating Flex Controls - Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual

Migrating applications to flex 2
Table of Contents

Advertisement

Instantiating Flex controls

In Flex 1.x, you created a Flex control in ActionScript by first including a reference to that
control, and then using the
createChildAtDepth()
These methods were removed. In Flex 2, you use the
attach the control to a container with the
example:
Flex 1.x:
var b:Button;
b = Button(createChild(Button, undefined, { label: "OK" }));
Flex 2:
var b:Button = new Button();
b.label = "OK";
addChild(b);
Similarly, in Flex 2 you would destroy the object with the
,
destroyChild()
destroyChildAt()
are also deprecated. Instead, you use the
Flex 1.x
method
createComponent()
createComponents()
The
createComponent()
than either a descriptor or a descriptor index. If you know the index, use
childDescriptors[i]
For more information on creating and destroying Flex controls in ActionScript, see the Flex 2
Developer's Guide.
174
Migration Patterns
createEmptyObject()
, or
createClassChildAtDepth()
, or
removeChild()
method
method now takes only a descriptor as its first argument, rather
to get the descriptor itself.
,
createChild()
method.
operator to create child controls and
new
or
addChild()
addChildAt()
destroyObject()
destroyAllChildren()
or
removeChildAt()
Flex 2
createComponentFromDescriptor()
createComponentsFromDescriptors()
,
createChildren()
method. For
,
method. These methods
method.
,

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents