1:特效类文件
View Code
package Components { import flash.display.DisplayObject; import mx.core.IFlexDisplayObject; import mx.effects.Blur; import mx.effects.Fade; import mx.effects.Move; import mx.events.TweenEvent; import mx.managers.PopUpManager; public class PopUpEffect { public function PopUpEffect() { } public static function Show(control:IFlexDisplayObject,parent:DisplayObject,modal:Boolean=true):void { var mShowEffect:Blur=new Blur(); mShowEffect.blurXFrom=255; mShowEffect.blurYFrom=255; mShowEffect.blurXTo=0; mShowEffect.blurYTo=0; mShowEffect.target= control; mShowEffect.duration=300; PopUpManager.addPopUp(control,parent,modal); PopUpManager.centerPopUp(control); mShowEffect.play(); } public static function FadeIn(control:IFlexDisplayObject,parent:DisplayObject,modal:Boolean=true):void { var fadeIn:Fade=new Fade(); fadeIn.duration=300; fadeIn.alphaFrom=0; fadeIn.alphaTo=1; PopUpManager.addPopUp(control,parent,modal); PopUpManager.centerPopUp(control); fadeIn.play(); } public static function Shan1(control:IFlexDisplayObject,parent:DisplayObject,modal:Boolean=true):void { var mShowEffect:Blur=new Blur(); mShowEffect.blurXFrom=-125; mShowEffect.blurYFrom=-125; mShowEffect.blurXTo=0; mShowEffect.blurYTo=0; mShowEffect.target= control; mShowEffect.duration=300; PopUpManager.addPopUp(control,parent,modal); PopUpManager.centerPopUp(control); mShowEffect.play(); } public static function MoveTo(x:int,y:int,control:IFlexDisplayObject,parent:DisplayObject,modal:Boolean=true):void { var move:Move=new Move(); move.end(); move.xFrom=parent.x; move.yFrom=parent.y; move.xTo=x; move.yTo=y; move.target=control; move.play(); } public static function Hide(control:IFlexDisplayObject):void { var mHideEffect:Blur=new Blur(); mHideEffect.blurXFrom=0; mHideEffect.blurYFrom=0; mHideEffect.blurXTo=255; mHideEffect.blurYTo=255; mHideEffect.addEventListener(TweenEvent.TWEEN_END,function(){ PopUpManager.removePopUp(control); }); mHideEffect.duration=300; mHideEffect.target=control; mHideEffect.play(); } } }
2: 程序文件
View Code
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import Components.PopUpEffect; protected function button1_clickHandler(event:MouseEvent):void { var moduleTem:test= new test(); PopUpEffect.Show(moduleTem,this,false); } ]]> </mx:Script> <mx:Button label="点击" horizontalCenter="0" verticalCenter="0" click="button1_clickHandler(event)"/> </mx:Application>
3:弹出窗体文件
View Code
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" backgroundColor="#2D0606"> <mx:Script> <![CDATA[ import Components.PopUpEffect; protected function button1_clickHandler(event:Event):void { PopUpEffect.Hide(this); } ]]> </mx:Script> <mx:Button x="305" y="256" label="取消" click="button1_clickHandler(event)"/> </mx:Module>
4:类文件还有别的特效可以试试