zoukankan      html  css  js  c++  java
  • Flex:实现Mac系统下滑式Alert窗口

    package
    {
        import flash.display.Sprite;
        import mx.controls.Alert;
        import mx.core.Application;
        import mx.effects.Move;
        import mx.effects.Parallel;
        import mx.effects.WipeUp;
        import mx.managers.PopUpManager;
        
        public class KAlert
        {
            public function KAlert()
            {
                super();
            }
            
            public static function show(text:String,modal:Boolean = false):void{
                var alert:Alert = new Alert();
                setAppleStyle(alert);
                setOpenEffect(alert);
                
                alert.text = text;
                var parent:Sprite = Sprite(Application.application);   
                PopUpManager.addPopUp(alert, parent, modal);
                alert.x = Application.application.width/2-100;
                alert.setActualSize(alert.getExplicitOrMeasuredWidth(), alert.getExplicitOrMeasuredHeight());            
            }
            
            //设置弹出窗口样式
            private static function setAppleStyle(alert:Alert):void{
                alert.setStyle("headerHeight",0);
                alert.setStyle("cornerRadius",0);
                alert.setStyle("shadowDirection","right");
                alert.setStyle("backgroundAlpha","1");
                alert.setStyle("backgroundColor","#dfe1e2");
                alert.setStyle("color","#333333");
                alert.setStyle("borderThicknessLeft","0");
                alert.setStyle("borderThicknessRight","0");
                alert.setStyle("borderThicknessTop","0");
                alert.setStyle("borderThicknessBottom","0");
                alert.setStyle("fontSize","12");
            }
            
            //设置弹出动画
            private static function setOpenEffect(alert:Alert):void{
                var wipeUp:WipeUp = new WipeUp(); //Wipe效果,方向向上
                var move:Move = new Move(); //移定效果
                var parallel:Parallel = new Parallel(); //加入其中的效果会被并发执行
                parallel.addChild(move);
                parallel.addChild(wipeUp);
                
                //设置弹出框在正中央
                move.xFrom = Application.application.width/2-100;
                move.xTo = Application.application.width/2-100;
                
                //弹出时从-100移动到100,同时wipeUp
                move.yFrom = -100;
                move.yTo = -1;
                //动画执行时间为300毫秒
                wipeUp.duration = 300;
                move.duration=300;
                //在当前控件被加入舞台时执行
                alert.setStyle("addedEffect",parallel)
            }
        }
    }

    引自:http://yecon.blog.hexun.com/29488118_d.html

  • 相关阅读:
    4、配置解决中文乱码的过滤器
    3、请求参数绑定
    2、SpringMVC常用注解
    SpringMVC快速搭建
    深拷贝与浅拷贝笔记
    SpringBoot入门(三)——SpringData JPA
    SpringBoot入门(二)——Web
    SpringBoot入门(一)——HelloWorld、配置、日志
    Java SSM(十八)——Mybatis查缺补漏
    Java SSM(十七)——SpringMVC查缺补漏
  • 原文地址:https://www.cnblogs.com/suenihy/p/2971614.html
Copyright © 2011-2022 走看看