flex中知道文本和按钮的id如何显示指定文本信息和点击调用函数
packageCVUI{ importcv.CVUI.CVButton; importcv.CVUI.UIManager; importcv...
package CVUI{ import cv.CVUI.CVButton; import cv.CVUI.UIManager; import cv.CVUI.UIObject; import flash.events.MouseEvent; public class UI_Class_MessageBox extends UIClass { public function UI_Class_MessageBox(UIMgr:UIManager, ui:UIObject) { super(UIMgr, ui); _comfirt = com("comfirt") as CVButton; _cancel = com("cancel") as CVButton; } public static var classReference:UI_Class_MessageBox; private var _handle:Function = null; private var _comfirt:CVButton = null; private var _cancel:CVButton = null; public function Open(txt:String, confirmhandler:Function = null):void{ _handle = confirmhandler; //显示指定提示信息txt //点击确认按钮后回调confirmhandler } public function ShowError(txt:String, errCode:int = 0):void{ //显示错误信息 //根据错误代码errCode显示错误信息 } public static function getErrorMsg(errCode:int):String{ switch(errCode) { case -101: return "服务器配置错误"; case -102: return "服务器内部错误"; } }} 注释为提示信息。
展开
1个回答
展开全部
不知道厅铅腔你想扮衫要激搭什么?提供一堆这么乱的代码。如果单纯按标题意思,实现很简单哪。
var btn:Button = new Button();
var txt:Text = new Text("Hello worl!");
btn.addEventListener(MOUSEEVENT.CLICK, onClickHandler);
this.addChild(btn);
private function onClickHandler(event:MouseEvent):void
{
Alert.Show(txt.Text);
}
var btn:Button = new Button();
var txt:Text = new Text("Hello worl!");
btn.addEventListener(MOUSEEVENT.CLICK, onClickHandler);
this.addChild(btn);
private function onClickHandler(event:MouseEvent):void
{
Alert.Show(txt.Text);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询