MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manuel d'utilisateur Page 120

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 184
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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.
Vue de la page 119
1 2 ... 115 116 117 118 119 120 121 122 123 124 125 ... 183 184

Commentaires sur ces manuels

Pas de commentaire