Hi,
I am trying to create a custom renderer for TileList that will have
two labels just below the thumbnail, but I can't set the icon
property: it doesn't display anything.
My TileList:
-------------------------
<mx:TileList id="myTileList"
dataProvider="{myDataArray}"
itemRenderer="MyCustomRenderer"
/>
-------------------------
My Renderer
-------------------------
public class MyCustomRenderer extends TileListItemRenderer
{
private var _lbl1:Label;
private var _lbl2:Label;
private var _img:Image;
public function MyCustomRenderer()
{
super();
}
override protected function createChildren():void
{
super.createChildren();
_img = new Image(); //holds thumbnail object
_lbl1 = new Label(); //first label
_lbl2 = new Label(); //second label
// addChild(_img ); //it works if I do this way, but why
don't I use icon?
addChild(_lbl1);
addChild(_lbl2);
}
override protected function commitProperties():void
{
super.commitProperties();
var vo:ProductVO = ProductVO(data);
_img.source = vo.thumbnail;
_lbl1.text = vo.title;
_lbl2.text = vo.descr;
this.icon = _img; //setting the icon
this.label.text = ""; //it shows ProductVO object's description,
don't know how to get rid of it the other way
}
}
-------------------------
It works the way I want if I do "addChild(_img )" in createChildren(),
but knowing that there is an icon property, I think the renderer
becomes heavier than it could be.
So, could you help me with:
1) How to make icon display the image?
2) Can I use "label" as one of my labels and add only one additional
Label (I need two labels)?
Thanks,
Djam.