MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual do Utilizador Página 174

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 184
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 173
174 Migration Patterns
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
createEmptyObject(), createChild(), createChildren(),
createChildAtDepth(), or createClassChildAtDepth() method.
These methods were removed. In Flex 2, you use the
new operator to create child controls and
attach the control to a container with the
addChild() or addChildAt() method. For
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 destroyObject(),
destroyChild(), destroyChildAt(), or destroyAllChildren() method. These methods
are also deprecated. Instead, you use the
removeChild() or removeChildAt() method.
The
createComponent() method now takes only a descriptor as its first argument, rather
than either a descriptor or a descriptor index. If you know the index, use
childDescriptors[i] to get the descriptor itself.
For more information on creating and destroying Flex controls in ActionScript, see the Flex 2
Developer’s Guide.
Flex 1.x Flex 2
createComponent() method
createComponentFromDescriptor()
createComponents()
method
createComponentsFromDescriptors()
Vista de página 173
1 2 ... 169 170 171 172 173 174 175 176 177 178 179 ... 183 184

Comentários a estes Manuais

Sem comentários