Sweet, thanks :)

On Tue, May 13, 2008 at 1:20 AM, wesley.petrowski <[EMAIL PROTECTED]>
wrote:

>   You can try something like this (seemed to work for me):
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute">
> <mx:Script>
> <![CDATA[
> import mx.controls.Label;
> override protected function createChildren():void
> {
> super.createChildren();
>
> var cssStyle:CSSStyleDeclaration;
>
> if (!StyleManager.getStyleDeclaration(".labelStyle"))
> {
> cssStyle = new CSSStyleDeclaration();
> }
> else
> {
> cssStyle = StyleManager.getStyleDeclaration(".labelStyle");
> }
>
> cssStyle.defaultFactory = function():void {
> this.fontSize = 18;
> this.color = 0xff0000;
> }
>
> StyleManager.setStyleDeclaration(".labelStyle", cssStyle,
> true);
>
> var l:Label = new Label();
> l.text = "This is a test";
> l.styleName = "labelStyle";
>
> addChild(l);
> }
> ]]>
> </mx:Script>
>
> <mx:Style>
> .labelStyle {
> color: #00ff00;
> }
> </mx:Style>
> </mx:Application>
>
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Josh
> McDonald" <[EMAIL PROTECTED]> wrote:
> >
> > Hey guys,
> >
> > let's say I have a Label I'm creating programmatically, and I'd
> like to have
> > some default styles (like a big red font), but still allow them to
> be
> > overriden with the stylesheet - can it be easily done?
> >
> > Cheers,
> > -J
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for
> thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: [EMAIL PROTECTED]
> >
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to