自定义弹出框 鼠标滑过按钮有特效
2012-03-06 11:54
411 查看
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>
相关文章推荐
- jQuery实现的鼠标滑过弹出放大图片特效
- 20种炫酷CSS3按钮鼠标滑过特效
- CSS3鼠标滑过彩色按钮动画特效
- Jquery幻灯片特效代码分享--鼠标滑过按钮时切换(2)
- jQuery实现的鼠标滑过弹出放大图片特效
- Jquery幻灯片特效代码分享--鼠标滑过按钮时切换(2)
- 纯CSS3鼠标滑过按钮动画过滤特效
- VC按钮的鼠标滑过效果的实现
- JEECG自定义弹出框按钮
- jquery特效 table鼠标滑过变色的实现代码
- 自定义 IE 鼠标右键弹出式
- JQuery鼠标经过弹出气泡框的js特效效果...
- 源码推荐(0718B):按钮菜单点击按钮动画弹出扇形菜单,自定义视频播放器封装AVPlayer
- 点击自定义按钮弹出百度商桥对话框
- css特效:鼠标滑过图片出现一道闪光效果
- JavaScript特效实例007-为弹出的窗口加入关闭按钮
- 点击按钮弹出可自定义小弹框即实现模态窗口
- 实现android手机来电拦截系统页面弹出自定义页面特效
- 常用的css3鼠标悬停按钮动画特效
- JS打造抖动的按钮特效(鼠标放上去开始抖动)