动态加载与销毁自定义组件


import com.xmercury.event.OpenAccountEvent;

import mx.utils.StringUtil;
import mx.managers.PopUpManager;

protected function openaccount_openAccountHandler(event:OpenAccountEvent):void
{
// TODO Auto-generated method stub
if(StringUtil.trim(event.state)=="1"){

openAccountContent.removeElement(openAccountPanel);
var rechargeWindow:openRecharge=new openRecharge();
PopUpManager.addPopUp(rechargeWindow,this,true);
PopUpManager.centerPopUp(rechargeWindow);
}
}

]]>


import com.xmercury.event.OpenAccRechargeEvent;
import com.xmercury.event.OpenAccountEvent;

import mx.managers.PopUpManager;
import mx.utils.StringUtil;

var rechargeWindow:openRecharge=new openRecharge();

protected function openaccount_openAccountHandler(event:OpenAccountEvent):void
{
// TODO Auto-generated method stub
if(StringUtil.trim(event.state)=="1"){

//openAccountContent.removeElement(openAccountPanel);
PopUpManager.addPopUp(rechargeWindow,this,true);
PopUpManager.centerPopUp(rechargeWindow);
rechargeWindow.rechargeButton.addEventListener(MouseEvent.CLICK,function():void{
PopUpManager.removePopUp(rechargeWindow);
});
}
}
]]>

var openAccount_:openAccount=new openAccount();

PopUpManager.addPopUp(openAccount_,this,true);
PopUpManager.centerPopUp(openAccount_);

openAccount_.x=FlexGlobals.topLevelApplication.stage.stageWidth/2-openAccount_.width/2;
openAccount_.y=FlexGlobals.topLevelApplication.stage.stageHeight/2-openAccount_.height/2;

openAccount_.cancelAccountButton.addEventListener(MouseEvent.CLICK,function():void{
PopUpManager.removePopUp(openAccount_); });

你可能感兴趣的:(Flex)