Thursday, January 28, 2010

Getting a value out of CSS file

I keep forgetting how to do this:

mx.styles.StyleManager.getStyleDeclaration('.styleclassname').getStyle('style')

This gets a value out of the CSS. So for example if you had a .lineStroke style with a style property of color and you wanted to use that for a stroke declared in MXML you could do this:

<mx:Stroke id="myStroke"
weight="1" color="{mx.styles.StyleManager.getStyleDeclaration('.lineStroke').getStyle('color')}"/>

No comments: