--- In [email protected], "Amy" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "Michael Schmalle" 
> <teoti.graphix@> wrote:
> >
> > The solution....
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas
> >     xmlns:mx="http://www.adobe.com/2006/mxml";
> >     width="200" height="50">
> > 
> >     <mx:Script>
> >         <![CDATA[
> > 
> >             override protected function commitProperties():void
> >             {
> >                 super.commitProperties()
> > 
> >                 if (data)
> >                 {
> >                     // uncomment to see this actually work
> >                     // setStyle("backgroundColor", 0xFF0000);
> > 
> >                     // imaginary prop
> >                     if (data.itemColor is Number)
> >                         setStyle("backgroundColor", 
data.itemColor);
> >                 }
> >             }
> > 
> >         ]]>
> >     </mx:Script>
> > 
> >     <mx:Label x="10" y="10" text="{data.label}"/>
> > 
> > </mx:Canvas>
> 
> I meant a CSS solution. I could possibly create a classFactory and 
> pass in the styleName in that, but that's not nearly as clean as 
just 
> using the TypeSelector.  I could also pass in a reference to the 
> Application and/or its styles and have the component look at that 
to 
> see if there is a style that matches the ClassName, but that's sort 
> of icky too.
> 
> Why is the List component set up to break this?

OK, I figured out how to tell my component "yes, I really want you to 
use your own style, regardless of where you are."

Here it is:

override protected function commitProperties(){
this.styleName=this.className;
}

Deceptively simple!  :-)

-Amy

Reply via email to