flex右下角弹窗
主应用
<?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"
creationComplete="init()">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<!--<s:DateTimeFormatter id="dformat" dateStyle="YYYY-MM-DD"/>-->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.managers.PopUpManager;
public function init():void{
}
protected function btn_clickHandler(event:MouseEvent):void
{
this.alertT();
}
private function alertT():void{
//浏览器的分辨率
var wx:Number=Capabilities.screenResolutionX;
var wy:Number=Capabilities.screenResolutionY;
var ma:MessAlert=new MessAlert();
ma.owner=this;
ma.x=wx-ma.width-25;
ma.y=wy-ma.height*2+35;
PopUpEffert.addPopUp(ma,this,true);
}
]]>
</fx:Script>
<s:Button id="btn" x="105" y="89" label="按钮" click="btn_clickHandler(event)"/>
</s:Application>
弹出窗口
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="356" height="236" title="弹出消息" close="closeHandler(event)"
creationComplete="init()">
<fx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
[Bindable]
public var titleInfo:String="test";
private function init():void{
msg.text=titleInfo;
setTimeout(close,1500);
}
protected function closeHandler(event:CloseEvent):void
{
this.close();
}
private function close():void{
//var tt:TimeTitle=this.owner as TimeTitle;
//tt.init();
PopUpEffert.removePopUp(this);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Label x="53" y="49" id="msg" text=""/>
</s:TitleWindow>
popup控制器
package
{
import flash.display.DisplayObject;
import flash.system.Capabilities;
import mx.core.IFlexDisplayObject;
import mx.effects.Move;
import mx.events.TweenEvent;
import mx.managers.PopUpManager;
public class PopUpEffert
{
public function PopUpEffert()
{
}
public static function addPopUp(window:IFlexDisplayObject,parent:DisplayObject,modal:Boolean):void{
//浏览器的分辨率
var wx:Number=Capabilities.screenResolutionX;
var wy:Number=Capabilities.screenResolutionY;
var move:Move=new Move(window);
move.duration=1000;
move.yFrom=wy;
move.yTo=wy-window.height*2+35;
move.play();
PopUpManager.addPopUp(window,parent,modal);
}
public static function removePopUp(window:IFlexDisplayObject):void{
//浏览器的分辨率
var wx:Number=Capabilities.screenResolutionX;
var wy:Number=Capabilities.screenResolutionY;
var move:Move=new Move(window);
move.duration=1000;
move.yFrom=wy-window.height*2+35;
move.yTo=wy;
move.addEventListener(TweenEvent.TWEEN_END,function():void{
PopUpManager.removePopUp(window);
});
move.play();
//PopUpManager.removePopUp(window);
}
}
}