Did you try:
if (data)
{
var c:Class = data.status == 0 ? _icon1 : _icon2;
image.source = new c();
}
On 3/18/15, 8:18 AM, "mark goldin" <[email protected]> wrote:
>I need to have a custom renderer in ADG to show different icons in a cell.
>Here is my simplified code for the renderer:
>
>private var _IconsSourceArrayCol:ArrayCollection = new ArrayCollection();
>
>[Embed(source=".icon1.png")]
>private var _icon1:Class;
>[Embed(source="icon2.png")]
>private var _icon2:Class;
>
>....
>override public function set data(value:Object):void
>{
>super.data = value;
>if (data)
>{
>_IconsSourceArrayCol.addItem({source:_icon1});
> _IconsSourceArrayCol.addItem({source:_icon2});
>image.source = _IconsSourceArrayCol[data.status].source;
>}
>}
>
>Is there a better way of doing it?
>
>Thanks