您的位置:首页 > 其它

FLEX QQ 弹出窗口(消息框)

2011-04-29 16:41 337 查看
今天突然想做这个 仿QQ 消息弹出窗口 网上搜了下 太麻烦 自己写了个 希望可以帮到人亦或做抛砖引玉之用 共同提高...

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" showCloseButton="true" close="closeHandler(event)"  borderColor="0x00bbcc" titleBackgroundSkin="{bg}" creationComplete="init()" rollOut="rollOutHandler(event)" rollOver="rollOverHandler(event)" layout="absolute">
<mx:Script>
<!--[CDATA[
import flash.utils.setTimeout;

import mx.binding.utils.BindingUtils;
import mx.controls.Alert;
import mx.events.CloseEvent;
private var hideTimer:Timer = new Timer(1);
private var showTimer:Timer = new Timer(1);

[Bindable]
[Embed("images/bannar_bg.png")]
public var bg:Class;
[Bindable]
[Embed("images/bannar_right.png")]
private var bannar_bg:Class;
[Bindable]
[Embed("images/question.gif")]
private var question:Class;
[Bindable]
public var text:String="Open ur eyes :"+"/n"+"  Open ur eyes so the sun can rise, flowers can blossom, birds can sing. Because all r waiting to see ur beautiful smile. Good Morning! ";
[Bindable]
private var mouseEvent:MouseEvent=null;
private function init():void{
this.y=this.parentApplication.height;
this.x=(this.parentApplication.width-this.width)-3;
this.title = "Message";
this.titleIcon=question;
this.setStyle("fontSize",13);
showTimer.addEventListener(TimerEvent.TIMER,doShowWindow);
showTimer.start();
hideTimer.addEventListener(TimerEvent.TIMER,doHideWindow);
}
private function doShowWindow(event:Event):void{
if(this.y+5>(this.screen.height-this.height)){
this.y -= 2;
}
else{
if(!mouseEvent){
showTimer.stop();
setTimeout(function ():void{hideTimer.start();},6500);
}
}

}

private function doHideWindow(result:Object):void{
if(this.y<(this.screen.height)){
this.y += 2;
}else{
hideTimer.stop();
}
}

protected function rollOverHandler(event:MouseEvent):void
{
mouseEvent=event;
if(!showTimer.running){
hideTimer.stop();
showTimer.start();
}
}

protected function rollOutHandler(event:MouseEvent):void
{
mouseEvent=null;
}

protected function closeHandler(event:CloseEvent):void
{
this.parentApplication.removeChild(this);
}

]]-->

</mx:Script>
<mx:HBox borderSkin="{bannar_bg}"  filters="{[new DropShadowFilter(8,45,0x777777)]}">
<mx:Text  fontSize="13" fontWeight="bold" height="150" width="280" x="49" y="73" text="{text}" />
</mx:HBox>
</mx:TitleWindow>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: