弹出窗口怎么作成动画的?
用PopUpManager作弹出窗口时,怎么让弹出窗口逐步放大显示出来?
我有一个自定义组件loginWindow.mxml,用
private function loginHandler():void {
var login : loginWindow = loginWindow(PopUpManager.createPopUp(this, loginWindow , true));
login.x = stage.stageWidth/2 - login.width/2;
login.y = stage.stageHeight/2 - login.height/2;
}
弹出这个窗口,问题是这个窗口很直接就显示出来了,我想让它慢慢变大地显示出来,应该怎么弄?
[解决办法]
下面是tcmis的做法,借花献佛了。
调用时
var loginWindow : loginWindow = new loginWindow();
PopUpEffect.show(loginWindow ,this,true);
package { import flash.display.DisplayObject; import jp.co.tac.linkage.ui.util.ScreenManager; import mx.core.Application; import mx.core.IFlexDisplayObject; import mx.effects.Blur; import mx.effects.Resize; import mx.effects.Zoom; 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:Zoom = new Zoom(); mShowEffect.zoomWidthTo=1; mShowEffect.zoomHeightFrom=0; mShowEffect.zoomWidthFrom=0; mShowEffect.duration=600; mShowEffect.target=control; mShowEffect.reverse(); mShowEffect.play(); PopUpManager.addPopUp(control, DisplayObject(Application.application), modal); ScreenManager.setCenter(DisplayObject(control)); } 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():void { PopUpManager.removePopUp(control); }); mHideEffect.duration=300; mHideEffect.target=control; mHideEffect.play(); } } }