One more note on this one:
 
Renderers have their TypeSelectors blocked for the styles:
 
backgroundColor
borderStyle
 
borderStyle is blocked because DataGrid/List has a borderStyle and if
you put a container in as your renderer, it would pick up that
borderStyle by default.
 
Similarly, backgroundColor is blocked, but also for another reason.  We
want the renderers to not have a background so the selection/highlight
colors can be drawn behind them and show through.
 
We can add this to the doc.
 
Stephen
 


________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Schmalle
Sent: Tuesday, June 03, 2008 12:43 PM
To: flexcoders@yahoogroups.com
Subject: Re: RES: [flexcoders] Using CSS with custom item renderers



Simply put, the IDataRenderer interface.

ItemRenderers are supposed to be encapsulated, if Adobe used anything
other than the styleName of the renderer's parent, they would be
breaking this encapsulation rule.

You could try un setting the styleName in commit properties and then try
your TypeSelector again. If that dosn't work, override
updateDisplayList() and unset it after super().

Mike


On Tue, Jun 3, 2008 at 11:48 AM, Amy <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


        

        --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Michael Schmalle" 
        <[EMAIL PROTECTED]> wrote:
        >
        
        > The solution....
        > 
        > <?xml version="1.0" encoding="utf-8"?>
        > <mx:Canvas
        > xmlns:mx="http://www.adobe.com/2006/mxml
<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?
        
        Thanks;
        
        Amy
        
        
        




-- 
Teoti Graphix, LLC
http://www.teotigraphix.com <http://www.teotigraphix.com> 

Teoti Graphix Blog
http://www.blog.teotigraphix.com <http://www.blog.teotigraphix.com> 

You can find more by solving the problem then by 'asking the question'. 

 

Reply via email to