According to the Flash 8 Actionscript Bible, it is possible to set a style that will affect all instances of a certain component class by typing the following code:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]controls[/COLOR].*;
[COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]styles[/COLOR].[COLOR=#000080]CSSStyleDeclaration[/COLOR];
[COLOR=#000000]_global[/COLOR].[COLOR=#000080]styles[/COLOR].[COLOR=#000080]componentClassName[/COLOR] = [COLOR=#000000]new[/COLOR] CSSStyleDeclarationCOLOR=#000000[/COLOR];
[COLOR=#000000]_global[/COLOR].[COLOR=#000080]styles[/COLOR].[COLOR=#000080]componentClassName[/COLOR].[COLOR=#0000FF]setStyle[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“styleAttribute”[/COLOR], [COLOR=#FF0000]“value”[/COLOR][COLOR=#000000])[/COLOR];
[/LEFT]
[/FONT]
A disclaimer says that “[this style technique] will work with almost all of the component classes. However, the following classes will not allow you to set a class style object: List, DataGrid, Tree, and Menu.” (ch 29, pg 644)
So why does the following do nothing:
[FONT=Courier New]_global.styles.Label = new CSSStyleDeclaration();
_global.styles.Label.setStyle(“autoSize”, “true”);
[/FONT]
??:sigh: