Category Archives: StyleManager

Styling Alert controls in Flex using the StyleManager class and setStyle() method (Flex 4 Edition)

In a previous example, “Styling Alert controls in Flex using the StyleManager class and setStyle() methods”, we saw how to style a Flex Alert control using the static StyleManager.getStyleDeclaration() method, and the setStyle() method.

The following example shows how you can do the same thing using the beta Flex 4 SDK by passing a fully qualified class name to the static getStyleDeclaration() method.

Continue reading Styling Alert controls in Flex using the StyleManager class and setStyle() method (Flex 4 Edition)

Dynamically styling error tips in Flex

In a previous example, “Changing the background color of an error tip in Flex”, we saw how you could change the background color of a Flex error tip by setting the borderColor style on the .errorTip CSS selector.

The following example shows how you can style the Flex .errorTip style dynamically using ActionScript using the static StyleManager.getStyleDeclaration() and setStyle() methods.

Full code after the jump.

Continue reading Dynamically styling error tips in Flex

Changing default line colors in a Flex LineChart control

The following example shows how you can change the line colors in a LineChart in Flex by setting the lineStroke style in MXML or ActionScript, as seen in the following snippets:

MXML:

<mx:LineSeries id="closeSeries" yField="@close" form="curve" displayName="Close">
    <mx:lineStroke>
        <mx:Stroke color="haloGreen" weight="2" alpha="0.6" />
    </mx:lineStroke>
</mx:LineSeries>

ActionScript:

<mx:LineSeries id="closeSeries" yField="@close" form="curve" displayName="Close" />
...
closeSeries.setStyle("lineStroke", new Stroke(0xFF0000, 2, 0.4));

Full code after the jump.

Continue reading Changing default line colors in a Flex LineChart control

Checking whether a color name is a valid color in Flex using the StyleManager class

The following example shows how to use the static StyleManager.isColorName() method to check whether a color name is valid or not. This method takes a single parameter, colorName, and returns a Boolean value representing whether the parameter is a valid alias for a color.

Full code after the jump.

Continue reading Checking whether a color name is a valid color in Flex using the StyleManager class

Building a simple style browser in Flex 3

In my previous post, “Introducing the StyleManager.selectors property in Flex 3“, we looked at the new StyleManager class’s static selectors property introduced in Flex 3.

This example shows how you can make a simple app which lets you loop over styles currently registered with the StyleManager and display their current style names and values.

Full code after the jump.

Continue reading Building a simple style browser in Flex 3

Introducing the StyleManager.selectors property in Flex 3

I was testing this today, and thought some people might find it useful. In more recent builds of the Flex 3 SDK, the StyleManager now includes a new static, read-only property, selectors. To quote the bug notes:

…This property returns an array of strings representing all of the selectors registered with the StyleManager.

For more information check out the bug at “[SDK-11706] Expose All Existing Styles via StyleManager”, and download a recent nightly build of the Flex 3 SDK at “Adobe Labs – Flex 3 Software Developement Kit”.

And as always, you can read the source code for the StyleManager class by extracting the SDK ZIP file and going to: “[flex_sdk_3.zip]\frameworks\projects\framework\src\mx\styles\StyleManager.as”.

The following example shows how you can use the new static selectors property in the Flex 3 StyleManager class to display a list of selectors currently registered with the style manager.

Full code after the jump.

Continue reading Introducing the StyleManager.selectors property in Flex 3