I have the following code from an InterRenderer, where I try to display two kind of icons depending on the value of its labelField within a Datagrid.
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import spark.components.DataGrid;
private var _listData:BaseListData;
[Bindable]
private var _isSelected:Boolean;
override public function prepare(hasBeenRecycled:Boolean):void {}
override public function set data( value:Object ) : void {
super.data = value;
//Alert.show( value.sent );
_isSelected = data.sent=='1'?true:false;
}
[Bindable]public function get listData() : BaseListData {
return _listData;
}
public function set listData( value:BaseListData ) : void {
_listData = value;
}
]]>
</fx:Script>
<s:Image id="btn_ok" horizontalCenter="0" source="@Embed('assets/images/ok_icon.png')"
visible="{_isSelected?true:false}"
verticalCenter="0"/>
<s:Image id="btn_ko" horizontalCenter="0" source="@Embed('assets/images/send_icon.png')"
visible="{_isSelected?false:true}"
verticalCenter="0"/>
The question is that I need to link the value of the labelField and in case it changes, one image hides and the other shows.
What's wrong in my code?
Thanks.