zoukankan      html  css  js  c++  java
  • Using the Image control as a pop up (转载)

    The following example shows how you can use the PopUpManager class to launch an modal Image control.

    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2007/10/18/using-the-image-control-as-a-pop-up/ -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            layout
    ="vertical"
            verticalAlign
    ="middle"
            backgroundColor
    ="white">

        
    <mx:Style>
            global {
                modalTransparencyBlur: 0;
                modalTransparency: 0.9;
                modalTransparencyColor: black;
                modalTransparencyDuration: 500;
            }
        
    </mx:Style>

        
    <mx:Script>
            
    <![CDATA[
                import mx.controls.Image;
                import mx.managers.PopUpManager;

                private const IMG_PREFIX:String = "http://www.helpexamples.com/flash/images/";

                private function popIt(src:String):void {
                    var img:Image = new Image();
                    img.addEventListener(MouseEvent.CLICK, img_click);
                    img.addEventListener(Event.COMPLETE, img_complete);
                    img.load(IMG_PREFIX + src);
                    img.toolTip = img.source.toString();
                    PopUpManager.addPopUp(img, this, true);
                }

                private function img_complete(evt:Event):void {
                    var img:Image = evt.currentTarget as Image;
                    img.width = img.contentWidth;
                    img.height = img.contentHeight;
                    PopUpManager.centerPopUp(img);
                }

                private function img_click(evt:MouseEvent):void {
                    var img:Image = evt.currentTarget as Image;
                    PopUpManager.removePopUp(img);
                }
            
    ]]>
        
    </mx:Script>

        
    <mx:ApplicationControlBar dock="true">
            
    <mx:Button label="image 1" click="popIt('image1.jpg');" />
            
    <mx:Button label="image 2" click="popIt('image2.jpg');" />
            
    <mx:Button label="image 3" click="popIt('image3.jpg');" />
        
    </mx:ApplicationControlBar>

    </mx:Application>

     
  • 相关阅读:
    浏览器阻止window.open的解决方案
    汇总前端最最常用的JS代码片段
    检测是否是微信浏览器
    添加标签
    如何去掉textarea右下角的灰色角标?
    移动WEB前端开发资源整合
    图片文字水平居中(移动端)
    文本形式访客计数器
    如何处理加括号的四则混合运算表达式——基于二叉树的实现(Eclipse平台 Java版)
    深拷贝,浅拷贝
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1642790.html
Copyright © 2011-2022 走看看