Something like:
imagePath="{data[DataGridListData(listData).dataField]}"
You'll need to add a listData getter/setter and implement
IDropInListItemRenderer. Copy the listData get/set from Label or
TextInput
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Steven
Sent: Monday, September 17, 2007 10:32 AM
To: [email protected]
Subject: [flexcoders] Changing the image in a custom component item
renderer
I am creating a datagrid that uses a custom component in an item
renderer to display one of 3 images (symbols of an embedded swf)
The data grid columns are created dynamically. I can't figure out how to
set the value of imagePath inside this custom component.
The symbol names are the same as the value for xmlColumn.localName();
Any help really appreciated!!
e.g
dgc = new DataGridColumn();
dgc.headerText = xmlColumn.localName();
dgc.itemRenderer=new ClassFactory(statusComponent);
dgc.dataField = xmlColumn.localName();
My custom component is as follows:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
<http://www.adobe.com/2006/mxml> width="100" height="30">
<mx:Script>
<![CDATA[
[Bindable]
[Embed('assets/icons.swf', symbol='incomplete')]
public var incomplete:Class;
[Bindable]
[Embed('assets/icons.swf', symbol='awaitingSubmission')]
public var awaitingSubmission:Class;
[Bindable]
[Embed('assets/icons.swf', symbol='submitted')]
public var submitted:Class;
public function set imagePath(value:String):void {
statusIcon3.source=this[value];
}
]]>
</mx:Script>
<mx:SWFLoader id="statusIcon3" x="5" y="6"/>
</mx:Canvas>