Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual page 120

Migrating applications to flex 2
Table of Contents

Advertisement

Using the StyleManager
When you use the StyleManager to apply styles to entire classes, you must now access the class
with the
getStyleDeclaration()
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
and
setStyle()
getStyle()
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
StyleManager.getStyleDeclaration("Accordion").setStyle("color","red");
StyleManager.getStyleDeclaration("Accordion").setStyle("fontFamily","Tahoma
");
You can also use the
StyleManager.setStyleDeclaration()
The
getNonInheritingStyle()
can now use the
getStyle()
120
Styles and Skinning
method. For example:
. This also applies to using StyleManager. While accessing styles
method; for example:
setStyle()
and
getInheritingStyle()
method instead.
method.
methods were removed. You

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents