Hi,
I would try to explicitly set the source of the images in the set data function.
For me that often helps when I run into strange itemrenderer behaviour.


Am 02.07.2010 17:43, schrieb Rajan:

Hi

I am using itemrenderer to display images. The images are displayed correctly according to the logic but when i click on the images the images are changed. I do not know what is causing the images to be change. Sometimes it even changes the image for row which is not clicked.

Any pointers why it is being changed.

Below is the code snippet from the itemrenderer.

[Bindable]
private var assets:AssetsImporter = AssetsImporter.getInstance();

override public function set data(value:Object):void
{
super.data=value;

var validationStatus:int=(value as PricingDataVO).getStatus();
if (validationStatus == ValidationConstants.NOT_VALIDATED)
{
purplePushPin.visible=true;
redPushPin.visible=false;
greenPushPin.visible=false;
orangePushPin.visible=false;
}
else if (validationStatus == ValidationConstants.ERROR)
{
purplePushPin.visible=false;
redPushPin.visible=true;
greenPushPin.visible=false;
orangePushPin.visible=false;
}
else if (validationStatus == ValidationConstants.SUCCESSULLY_VALID)
{
purplePushPin.visible=false;
redPushPin.visible=false;
greenPushPin.visible=true;
orangePushPin.visible=false;
}
else if (validationStatus == ValidationConstants.WARNING)
{
purplePushPin.visible=false;
redPushPin.visible=false;
greenPushPin.visible=false;
orangePushPin.visible=true;
}
else
{
purplePushPin.visible=false;
redPushPin.visible=false;
greenPushPin.visible=false;
orangePushPin.visible=false;
}
}

private function onImageClick(event:Event):void
{
var selectedRowEvent:SelectedRowEvent = new SelectedRowEvent("statusServicePlan", true);
var pricingDataVO:PricingDataVO = data as PricingDataVO;
selectedRowEvent.id = pricingDataVO.id;
selectedRowEvent.seqId = pricingDataVO.seqId;
selectedRowEvent.source = pricingDataVO.source;
selectedRowEvent.origSeqId = pricingDataVO.origSeqId;
selectedRowEvent.data = data;
dispatchEvent(selectedRowEvent);
}

images are declared in the below way.

<mx:Image source="{assets.greenPushPin}"
x="5" click="onImageClick(event)"
id="greenPushPin"
toolTip="Validated Successfully"
width="20"
buttonMode="true"
visible="false"
height="20"/>

<mx:Image source="{assets.purplePushPin}"
x="5" click="onImageClick(event)"
id="purplePushPin"
toolTip="Not Validated"
width="20"
buttonMode="true"
visible="false"
height="20"/>

Thanks
ilikeflex



Reply via email to