# styling components: \_global.styles.Label.setStyle("autoSize", "true"); does not work

**URL:** <https://forum.kirupa.com/t/styling-components--global-styles-label-setstyle-autosize-true-does-not-work/217182>\
**Category:** Uncategorized\
**Created:** [February 23, 2007, 9:13pm UTC](https://forum.kirupa.com/t/styling-components--global-styles-label-setstyle-autosize-true-does-not-work/217182 "2007-02-23T21:13:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalewb](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dalewb/32/3029_2.png) [@dalewb](https://forum.kirupa.com/u/dalewb)\
**Post date:** [February 23, 2007, 9:13pm UTC](https://forum.kirupa.com/t/styling-components--global-styles-label-setstyle-autosize-true-does-not-work/217182/1 "2007-02-23T21:13:03Z")

</div>

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:
