居中:
1)只能满足弹出窗基于父窗体是居中的
PopUpManager.addPopUp(myPageHome,this,true);
PopUpManager.centerPopUp(myPageHome);
2)相对于整个屏幕居中:
myPageHome.x=FlexGlobals.topLevelApplication.stage.stageWidth/2-myPageHome.width/2;
myPageHome.y=FlexGlobals.topLevelApplication.stage.stageHeight/2-myPageHome.height/2;
自定义PopUpEffect与使用:
定义:
package myAs
{
import flash.display.DisplayObject;
import mx.core.IFlexDisplayObject;
import mx.effects.Blur;
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=500;
PopUpManager.addPopUp(control,parent,modal);
PopUpManager.centerPopUp(control);
mShowEffect.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.duration=500;
mHideEffect.addEventListener(TweenEvent.TWEEN_END,function(){
PopUpManager.removePopUp(control);
});
mHideEffect.duration=300;
mHideEffect.target=control;
mHideEffect.play();
}
}
}
使用:
PopUpEffect.Show(myPageHome,this);
弹出TitleWindow后不能进行其它任何操作设置方法:
protected function showStationInfoWin():void
{
stationInfoWin = new StationInfoWin();
stationInfoWin.paraObj = this;//创建属性子窗体与父窗体之间的联系
MyPop(stationInfoWin,this,800,600);
}
/* 弹出时不能进行其它任何操作 */
public function MyPop(pop:IFlexDisplayObject,father:DisplayObject,_width:Number,_height:Number):void
{
PopUpManager.addPopUp(pop,father,true);
PopUpManager.centerPopUp(stationInfoWin);
}