Flex4.6类似迅雷的果冻弹窗效果的类

        看到迅雷7的弹窗效果觉得非常酷,但搜遍全网,都没有发现类似的源码,只得自己动手写一下了,代码不是很难,只有两个方法,即弹出窗口及移除窗口,但回过头来想下,没有很好的空间想像力真的难实现,下面贴上代码:

/**
		 * 弹出窗口,果冻效果
		 * @param control 窗口目标
		 * @param parent 父级
		 * @param modal
		 * @param backfunction 回调函数
		 *
		 */
		public static function show(control:IFlexDisplayObject, parent:DisplayObject=null, modal:Boolean=true, backfunction:Function=null):void
		{
			if(!parent)
				parent=Sprite(FlexGlobals.topLevelApplication);
			var rotate3D:Rotate3D=new Rotate3D();
			rotate3D.target=control;
			rotate3D.duration=180;
			rotate3D.autoCenterTransform=true;
			rotate3D.projectionX=(control.width);
			rotate3D.projectionY=(control.height);
			rotate3D.autoCenterProjection=false;
			rotate3D.angleXFrom=-5;
			rotate3D.angleXTo=0;
			rotate3D.angleYFrom=5;
			rotate3D.angleYTo=0;
			rotate3D.addEventListener(EffectEvent.EFFECT_END, function(e:EffectEvent):void
			{
				move3d.play();
			});

			var fade:Fade=new Fade();
			fade.target=control;
			fade.duration=400;
			fade.repeatCount=1;
			fade.alphaFrom=0;
			fade.alphaTo=1;

			var move3d:Move3D=new Move3D();
			move3d.target=control;
			move3d.duration=100;
			move3d.repeatBehavior="reverse";
			move3d.xBy=-2;
			move3d.zBy=-2;
			move3d.repeatCount=2;
			move3d.addEventListener(EffectEvent.EFFECT_END, function(e:EffectEvent):void
			{
				if (backfunction != null)
				{
					backfunction();
				}
			});
			PopUpManager.addPopUp(control, parent, modal);
			PopUpManager.centerPopUp(control);
			rotate3D.play();
			fade.play();
		}

		/**
		 * 关闭窗口
		 * @param control 目标
		 * @param backfunction 回调函数
		 *
		 */
		public static function remove(control:IFlexDisplayObject, backfunction:Function=null):void
		{
			var rotate3D:Rotate3D=new Rotate3D();
			rotate3D.target=control;
			rotate3D.duration=400;
			rotate3D.autoCenterTransform=true;
			rotate3D.projectionX=0;
			rotate3D.projectionY=0;
			rotate3D.autoCenterProjection=false;
			rotate3D.angleXFrom=0;
			rotate3D.angleXTo=5;
			rotate3D.angleYFrom=0;
			rotate3D.angleYTo=-5;

			rotate3D.addEventListener(EffectEvent.EFFECT_END, function(e:EffectEvent):void
			{
				PopUpManager.removePopUp(control);
				if (backfunction != null)
				{
					backfunction();
				}
			});

			var fade:Fade=new Fade();
			fade.target=control;
			fade.duration=250;
			fade.repeatCount=1;
			fade.alphaFrom=1;
			fade.alphaTo=0;

			var move3d:Move3D=new Move3D();
			move3d.target=control;
			move3d.duration=400;
			move3d.xBy=50;
			move3d.zBy=50;
			move3d.repeatCount=1;

			rotate3D.play();
			move3d.play();
			fade.play();
		}

代码原理就不讲了,大家自己捉摸吧,如果觉得效果不明显,可以自己设置里面的一些参数,运行起来是不是很酷?如需转载请注明出处,谢谢! http://my.csdn.net/neil89

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值