I have a custom external itemRenderer which I use to display items in a mx:List. The dataProvider is an Array that contains 4 attributes per element. It seems as if the itemRenderer is, in fact, getting the Array because it displays 4 items(the amount of items in the Array) but the items are displayed as "[object Object]".
Here is my itemRenderer...
<mx:Metadata>
[Event(type="classes.events.RemoveEntryEvent", name="removeProject")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import classes.events.RemoveEntryEvent;
import mx.controls.Alert;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
override public function set data (value:Object):void{
super.data = value;
//Alert.show(value.toString());
}
public function button_clickHandler():void {
var alertListener:Function = function(closeEvent:CloseEvent):void{
if (closeEvent.detail == Alert.YES){
//dispatchEvent(new RemoveEntryEvent(RemoveEntryEvent.REMOVE_PROJECT, true, false, data));
}
}
var myAlert:Alert = Alert.show("Are you sure you want to remove yourself from this project?",
"Remove Project",
(Alert.YES | Alert.CANCEL),
null, alertListener);
myAlert;
}
private function text_clickHandler():void{
Alert.show("inside text_clickHandler()");
}
]]>
</mx:Script>
<!-- The mx:Text should display a hand maybe when rolledOver: !buttonMode, -->
<mx:Text id="text" width="85%" text="{data}" fontThickness="5" click="text_clickHandler()"/>
<mx:Button id="removeButton" label="Remove" fontSize="9" width="63" verticalCenter="0" fontWeight="normal" x="329"
height="17" click="button_clickHandler()"></mx:Button>
</mx:Canvas>
When I step through the set data function, the 'value:Object' is null! But again, it is displaying the correct amount of items.
Here is my mxml code in which my mx:List is contained...
<mx:TitleWindow y="10" width="550" height="342" layout="absolute" title="LIST OF PROJECTS" cornerRadius="4" id="listOfProjects_panel" horizontalCenter="0">
<mx:List alternatingItemColors="{altColors}" x="65.5" y="30" width="399" height="232" backgroundColor="#F8F8F8" fontSize="12" dataProvider="{xmlSimpleArray}"
id="list_of_projects_master" initialize="listInitializer()" useRollOver="false" selectable="false">
</mx:List>
<mx:Button y="270" label="Refresh List" width="130" x="334.5" id="auth_btn_master0" fontWeight="normal"/>
<mx:Label x="65.5" y="10" text="Click To Select A Project:" fontWeight="bold"/>
</mx:TitleWindow>
Here is the initializer in my mx:Script...
private function listInitializer():void{
//list_of_projects_master.dataProvider = xmlSimpleArray;
list_of_projects_master.itemRenderer = new ClassFactory(ProjectListRenderer);
list_of_projects_master.addEventListener(RemoveEntryEvent.REMOVE_PROJECT, updateXML);
}
If anymore information is needed to assess the issue, please let me know
change the below line in itemrenderer
shoul be like
hope this helps.