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

  • 相关阅读:
    [BZOJ2212][POI2011]Tree Rotations(线段树合并)
    [BZOJ3569]DZY Loves Chinese II(随机化+线性基)
    [BZOJ3237][AHOI2013]连通图(分治并查集)
    [BZOJ4945][NOI2017]游戏(2-SAT)
    [BZOJ4568][SCOI2016]幸运数字(倍增LCA,点分治+线性基)
    [BZOJ2460][BJOI2011]元素(线性基)
    [BZOJ4942][NOI2017]整数(线段树+压位)
    [P2023][AHOI2009]维护序列(线段树)
    [HDU4336]Card Collector(min-max容斥,最值反演)
    [COGS2426][HZOI 2016]几何
  • 原文地址:https://www.cnblogs.com/suenihy/p/2971614.html
Copyright © 2011-2022 走看看