Try: IStyleManager(
Singleton.getInstance("mx.styles::IStyleManager2")
On 2/3/10 5:50 AM, "cyril ronseaux" <[email protected]> wrote:
Hi,
Thanks for the answer. I'm working on Flex3 for the moment.
I searched quickly how to get the IStyleManager for flex3, and,... well, ...
I'll have to wait for your help :)
I tried the most naive way, StyleManager.styleDeclarationsChanged() and since
its mx_internal it won't let me.
Cyril
On Wed, Feb 3, 2010 at 7:42 AM, Alex Harui <[email protected]> wrote:
Use loadStyleDeclarations(url, false);
Call registerColorName
Get the IStyleManager (how to do it depends on your version of Flex)
Call IStyleManager.styleDeclarationsChanged()
On 2/2/10 9:34 AM, "cyril ronseaux" <[email protected]
<http://[email protected]> > wrote:
Hi,
background : we are trying to simplify maintenance of CSS stylesheets by
declaring "theme colors" once, and using them everywhere else. We intend to
read a specific style declaration (e.g. getStyleDeclaration("global",
"maincolor") ), to then register color names for that color :
StyleManager.registerColorName("maincolor",
theColorWeJustReadFromGlobalDeclaration), and use that just-registered
colorname everywhere we need that color in our CSS.
For now, i'm stuck with an issue : components that use styles that reference my
custom color, do not pick the color until I RE-load the CSS.
I'm loading style dynamically :
StyleManager.loadStyleDeclarations(url, true); // a swf containing the CSS
On style complete :
StyleManager.registerColorName("mycolor", 0x00FF00);
In the CSS :
. test {
color: prout;
}
Component :
<mx:Label text="hello, i'm testing custom colors" styleName="test" />
To make it works I had to add : StyleManager.loadStyleDeclarations(url, true);
a second tome after the registerColorName :
On style complete :
StyleManager.registerColorName("mycolor", 0x00FF00);
StyleManager.loadStyleDeclarations(url, true);
But I wish I could do it without having to reload the stylesheet.
I tried : this.styleChanged(null); // this is application
and
this.styleInitialized();
Any idea ?
Thanks in advance.
Cyril
--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui