I have the below function creating new panels inside my ViewStack.. This works fine and they are great.. However i am trying to put some content into the panels but i am failing.
private function viewstack_addChild(name:String):void {
//if (accordion.numChildren < MAX_CHILDREN) {
var p:Panel = new Panel();
p.id = name;
p.name = name;
p.title = name;
p.percentWidth = 100;
p.percentHeight = 100;
var display:PageItemRenderer = new PageItemRenderer;
p.finishPrint(display);
var randColor:uint = Math.random() * 0xFFFFFF;
p.setStyle("backgroundColor", randColor);
myViewStack.addChild(p);
//myViewStack.selectedChild = p;
//}
}
I have a custom itemrenderer called PageItemRenderer that will accept the xml data and display it but i cannot figure out how to call the renderer for each panel..
Any help would be greatly appreciated.
EDIT: Adding PageItemRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox
height="100%"
width="100%"
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:HBox width="100%" height="100%">
<mx:VBox height="100%" width="20%" horizontalAlign="center" verticalAlign="middle">
<!-- software image -->
<mx:Image source="{data.image}" width="90%" height="90%"/>
</mx:VBox>
<!-- person's name -->
<mx:VBox height="100%" width="80%" horizontalAlign="left" verticalAlign="middle">
<mx:Label width="100%" height="100%" text="{data.name} {data.version}" color="#FFAE00"/>
<mx:Label width="100%" height="100%" text="{data.description}" color="#FFFFFF"/>
</mx:VBox>
</mx:HBox>
</mx:HBox>