Flex4 - ItemRenderer内通过dataChange事件检查是否需要更新
由于渲染器render是重复使用的,所以render里可以通过dataChange事件来检查是否需要更新
<?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autoDrawBackground="true" dataChange="dataChangeHandler(event)"> <fx:Script> <![CDATA[ import mx.events.FlexEvent; protected function dataChangeHandler(event:FlexEvent):void { if(data.email ==""){ //........ }else{ //........ } } ]]> </fx:Script> <s:Label text="{data.text}"/> </s:ItemRenderer>