In flex, enable property doesn't work for image and radio button etc..here is the sample code for enable and disable the image events....
in the below code the image automatically disabled due to application complete...
once u click the button the image enabled and the event also occur....
code:
?xml version="1.0" encoding="utf-8"?>
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="disableImages();">
mx:Script>
![CDATA[
import mx.controls.Alert;
private function disableImages():void{
//remove the click listener from image
myImg.alpha=0.2;
myImg.removeEventListener(MouseEvent.CLICK, btnClickHandle);
}
private function enableImages():void{
//remove the click listener from image
myImg.alpha=1;
myImg.addEventListener(MouseEvent.CLICK,btnClickHandle);
}
public function btnClickHandle(e:MouseEvent):void
{
Alert.show("enable");
}
]]>
/mx:Script>
mx:Image source="oscar_dresses.jpg" id="myImg"/>
mx:Button label="click" click="enableImages();"/>
/mx:Application>
No comments:
Post a Comment