MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manuale Utente Pagina 174

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 184
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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()
Vedere la pagina 173
1 2 ... 169 170 171 172 173 174 175 176 177 178 179 ... 183 184

Commenti su questo manuale

Nessun commento