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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 184
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 119
120 Styles and Skinning
Using the StyleManager
When you use the StyleManager to apply styles to entire classes, you must now access the class
with the
getStyleDeclaration() method. For example:
Flex 1.x:
StyleManager.styles.Button.setStyle("color","red");
Flex 2:
StyleManager.getStyleDeclaration("Button").setStyle("color","red");
You can no longer set or get styles as properties of a component or class. You now use
setStyle() and getStyle(). This also applies to using StyleManager. While accessing styles
this way was discouraged in Flex 1.5, it was not prohibited until now.
Flex 1.x:
var c = myButton.color;
StyleManager.styles.TextArea.color = "red";
Flex 2:
var c:Number = myButton.getStyle("color");
StyleManager.getStyleDeclaration("TextArea").setStyle("color","red");
In addition, you can no longer create a CSSStyleDeclaration object and then apply it to a type
of control, as the following example shows:
public var styleObj:CSSStyleDeclaration = new CSSStyleDeclaration();
styleObj.setStyle("color","red");
styleObj.setStyle("fontFamily","Tahoma");
StyleManager.styles.Accordion = styleObj;
You must now use the setStyle() method; for example:
StyleManager.getStyleDeclaration("Accordion").setStyle("color","red");
StyleManager.getStyleDeclaration("Accordion").setStyle("fontFamily","Tahoma
");
You can also use the StyleManager.setStyleDeclaration() method.
The
getNonInheritingStyle() and getInheritingStyle() methods were removed. You
can now use the
getStyle() method instead.
Vedere la pagina 119
1 2 ... 115 116 117 118 119 120 121 122 123 124 125 ... 183 184

Commenti su questo manuale

Nessun commento