现有如下小图片:
<mx:Image id="smallerimg" height="20" width="30" source="{data.picpath}" visible="false" click="smallerimg_clickHandler(event)"/>
点击事件:
protected function smallerimg_clickHandler(event:MouseEvent):void
{
var imgShow:Image = new Image();
imgShow.source=smallerimg.source;
imgShow.maintainAspectRatio = true;
imgShow.addEventListener(Event.COMPLETE, image_complete);
imgShow.addEventListener(ResizeEvent.RESIZE, image_resize);
imgShow.addEventListener(MouseEvent.CLICK, image_click);
imgShow.setStyle("addedEffect", image_addedEffect);
imgShow.setStyle("removedEffect", image_removedEffect);
PopUpManager.addPopUp(imgShow,this.parentApplication as Default, true);
}
private function image_click(evt:MouseEvent):void {
PopUpManager.removePopUp(evt.currentTarget as Image);
}
private function image_resize(evt:ResizeEvent):void {
PopUpManager.centerPopUp(evt.currentTarget as Image);
}
private function image_complete(evt:Event):void {
PopUpManager.centerPopUp(evt.currentTarget as Image);
}
<s:Wipe direction="down" startDelay="100" id="image_addedEffect"/>
<s:Parallel id="image_removedEffect">
<mx:Zoom />
<mx:Fade />
</s:Parallel>
代码this.parentApplication as Default让图片在应用程序中显示。