Main.mxml
-------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private var test:Test;
protected function button1_clickHandler(event:MouseEvent):void
{
test = new Test();
PopUpManager.addPopUp(test,this,false);
startTimer();
}
public function startTimer():void {
var myTimer:Timer = new Timer(5000);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
public function timerHandler(event:TimerEvent):void {
PopUpManager.removePopUp(test);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button x="245" y="270" label="Add PopUp" click="button1_clickHandler(event)"/>
</s:Application>
-----------------------------------------------------------------
Test.mxml (popUp)
-----------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
height="200" width="200" addedEffect="{fadeIn}" removedEffect="{fadeOut}">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:Fade id="fadeOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<s:Fade id="fadeIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
</fx:Declarations>
<s:Button label="Button"/>
</s:Panel>
|