Styles in Apache Flex Applications

For applications developed in Apache Flex 3.x, Silk Test Classic does not distinguish between styles and properties. As a result, styles are exposed as properties. However, with Apache Flex 4.x, all new Flex controls, which are prefixed with Spark, such as SparkButton, do not expose styles as properties. As a result, the GetProperty() and GetPropertyList() methods for Flex 4.x controls do not return styles, such as color or fontSize, but only properties, such as text and name.

The GetStyle(string styleName) method returns values of styles as a string. To find out which styles exist, refer to the Adobe Help located at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package-detail.html.

If the style is not set, a StyleNotSetException occurs during playback.

For the Flex 3.x controls, such as FlexTree, you can use GetProperty() to retrieve styles. Or, you can use GetStyle(). Both the GetProperty() and GetStyle() methods work with Flex 3.x controls.

Calculating the Color Style

In Flex, the color is represented as a number. It can be calculated using the following formula:

red*65536 + green*256 + blue

Example

In this example, the GetProperty() and GetStyle() methods are used to retrieve styles:
Window myTree = Application.Find("//FlexTree[@caption='myTree']")
COLOR  c = {170, 179, 179}
Verify(myTree.DisabledColor, c)
Verify(myTree.GetProperty("disabledColor"), {170, 179, 179})
Verify(myTree.GetStyle("disabledColor"), "11187123")

The number 11187123 for the color calculates as 170*65536 + 179*256 + 179.