Flex4 点击小图片放大并居中显示

原文链接:http://www.cnblogs.com/skynothing/archive/2010/10/22/1858022.html Flex4 点击小图片放大并居中显示

现有如下小图片:

<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让图片在应用程序中显示。

posted on 2010-10-22 09:55 kimhom wong 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/skynothing/archive/2010/10/22/1858022.html

上一篇:JavaScript"模拟事件"的注意要点


下一篇:63.实现一个拖拽排序