自定义弹出框 鼠标滑过按钮有特效

 
package game.view.component.alert
{
 import com.greensock.TweenLite;
 
 import flash.display.DisplayObject;
 
 import game.view.component.alert.AlertBtnType;
 import game.view.component.alert.AlertCanvas;
 
 import mx.core.Application;
 import mx.managers.PopUpManager;
 import mx.managers.PopUpManagerChildList;
 
 public class AlertWindow
 {
  private static var alertCanvas:AlertCanvas = null;
  
  public var func:Function;
  
  public static var detail:String = '';
  
  public static function show(txt:String='',show:int=1,model:Boolean=true,func:Function = null):void
  {
   if(alertCanvas == null)
   {
    alertCanvas = new AlertCanvas();
    alertCanvas.okBtnShow = true;
    alertCanvas.noBtnShow =  show==2?true:false;
    TweenLite.to(alertCanvas,0.2,{alpha:1});//对弹出框添加滤镜效果
    alertCanvas.tips = txt;//将要显示的内容赋给弹出框的tips
    alertCanvas.func = func;
    
    var app:DisplayObject = Application.application as DisplayObject;  
    PopUpManager.addPopUp(alertCanvas, app, model, PopUpManagerChildList.APPLICATION);
    PopUpManager.centerPopUp(alertCanvas);
    TweenLite.from(alertCanvas,.2,{'alpha':0});
   }
  }
  //移除组件
  public static function  hide():void
  {
   if(alertCanvas != null)
   {
    TweenLite.to(alertCanvas,0.2,{alpha:0});
    TweenLite.delayedCall(0.2,function():void
    {     
     PopUpManager.removePopUp(alertCanvas);
     alertCanvas = null; 
    }); 
    
    
    
   }
  }
  
  public function AlertWindow()
  {
  }

 }
}


 

 

//  AlertCanvas   弹出框用用的小组件都是自定义的,可以用adob封装的组件替代

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="235" styleName="alertCanvas"
	 height="131"  xmlns:com="game.view.component.*" xmlns:help="game.help.*">
	
	<mx:Script>
		<![CDATA[
			import game.help.ResourceHelp;
			public var func:Function;
			[Bindable]
			public var tips:String = "";
			[Bindable]
			public var noBtnShow:Boolean = false;
			[Bindable]
			public var okBtnShow:Boolean = false;

			private function backFunction(type:String):void
			{
				if(func != null)
				{
					func(type);
				}
				AlertWindow.hide();
			}
		]]>
	</mx:Script>
		<help:TextLArea id="txt" text="{tips}" horizontalCenter="0" y="35" fontSize="15" width="190" height="40" borderStyle="none"
		 backgroundAlpha="0" borderThickness="0" focusAlpha="0"   enabled="false"  selectable="false" textAlign="center"/>
	<mx:HBox width="180" height="30" bottom="22"  horizontalCenter="0" horizontalGap="8" horizontalAlign="center" verticalAlign="middle" >
		<com:WarButton id="okBtn" styleName="investQDbut" click="backFunction('ok');" visible="{okBtnShow}" includeInLayout="{okBtnShow}"/>
		<com:WarButton id="noBtn" styleName="investQXbut" click="backFunction('no')"  visible="{noBtnShow}" includeInLayout="{noBtnShow}"/>
	</mx:HBox>
	
</mx:Canvas>


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值