What I normally do, is extend the list component and
add a bunch of public properties or styles to it.
eg. public var titleColor:uint;

Then in my item renderer class, I override the
commitProperties function, and in there grab the
properties and styles I need from the list.
eg.
var tmp:CustomList = this.owner.parent as CustomList;
this.setTitleColor( tmp.titleColor );

Hopefully that makes sense.

One other thing you might want to do if you use this
approach, is to cause the item renderers to re-request
their styling information if the styles change at
runtime. This can be done by adding a function to your
CustomList like this one (note, this funciton came
from inside a custom DataGrid of mine, but should be
easy to translate to other list types)

public function invalidateItemStyles():void
for (var rows:int = 0; rows < listItems.length;
rows++)
{
var rowArray:Array = listItems[rows];
                
for (var cols:int = 0; cols < rowArray.length; cols++)
{
var colItem:UIComponent = rowArray[cols] as
UIComponent;
                
if (colItem)
colItem.invalidateProperties(); // refresh
}
}
}


Hope that helps
-Tony
http://www.munkiihouse.com

--- "scott.royston" <[EMAIL PROTECTED]> wrote:

> I have the same item renderer in multiple lists, and
> want them to look different.  Is there 
> no way to do it on a per-list basis?
> 
> Also, I believe the type-selector gets overridden by
> the ListContentHolder, but I will 
> double check.
> 
> Thanks.
> 
> --- In flexcoders@yahoogroups.com, "Alex Harui"
> <[EMAIL PROTECTED]> wrote:
> >
> > Create a type-selector for your renderer class
> > 
> >  
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of scott.royston
> > Sent: Tuesday, January 22, 2008 1:21 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Styling List ItemRenderers
> > 
> >  
> > 
> > How can I style my itemrenderers in a List via
> CSS? Right now they seem
> > to be inheriting 
> > everything from the List component (via the
> ListContentHolder), which is
> > definitely not what I 
> > want.
> > 
> > Thanks
> >
> 
> 
> 
> 

Reply via email to