Or you can go the extra mile and use CSSStyleDeclaration class along
with the StyleManager to create styles in actionscript and then
reference those styles from other actionscript files or mxml using
the styleName property, something like:
MXML file:
<MyComponent styleName="myTitleStyle"/>
Actionscript file:
var myTitleStyle:CSSStyleDeclaration = new CSSStyleDeclaration
("myTitleStyle");
myTitleStyle.setStyle('fontFamily', 'Tahoma');
myTitleStyle.setStyle('fontWeight', "bold");
myTitleStyle.setStyle('fontSize', 18);
myTitleStyle.setStyle('color', 0x333333);
StyleManager.setStyleDeclaration
(".myTitleStyle",myTitleStyle,true);
Bruce
--- In [email protected], "Andrew Trice"
<[EMAIL PROTECTED]> wrote:
>
> In actionscript you can also use the setStyle method to
programmatically
> set any of the styles for that element.
>
>
>
> myTextBox.setStyle("color", 0xFF0000);
>
>
>
>
>
> -Andy
>
>
>
> _____________________________________
>
> Andrew Trice
>
> Cynergy Systems, Inc.
>
> http://www.cynergysystems.com
>
>
>
> Blog: http://www.cynergysystems.com/blogs/page/andrewtrice
>
> Email: [EMAIL PROTECTED]
>
> Office: 866-CYNERGY
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of amey admulwar
> Sent: Monday, December 04, 2006 4:29 AM
> To: [email protected]
> Subject: Re: [flexcomponents] adding a CSS programmatically in ".as"
> file ?
>
>
>
> Hi Arpan
>
> You can do this in .as file by just creating CSS classes in action
> script. by contol name
>
> Text
> {
> color : #ffffff;
> ...
> };
>
> or
> .class_name
> {
> color : #ffffff;
> ...
> }
>
> and just set style Name attribut in resp. control
styleName="class_name"
> it will work just same as <mx:Script> tag
>
> Amey.
>
>
>
>
> Amey.
>
> arpan srivastava <[EMAIL PROTECTED]> wrote:
>
> Hi,
> Is there anyway we can add CSS programmatically in ".as"
> file rather than adding in the mxml file with <mx:style /> tag.
>
>
>
>
> ________________________________
>
>
> Access over 1 million songs - Yahoo! Music Unlimited.
>
<http://pa.yahoo.com/*http:/us.rd.yahoo.com/evt=36035/*http:/music.yah
oo
> .com/unlimited/>
>
>
>
>
>
> ________________________________
>
> Everyone is raving about the all-new Yahoo! Mail beta.
>
<http://us.rd.yahoo.com/evt=45083/*http:/advision.webevents.yahoo.com/
ma
> ilbeta>
>