Alert

A client asked me to do something seemingly simple.
"I want the Alert to have just this one sentence bolded."

Well, it's not exactly simple, so here's how you do it:

 

there are two solutions as below :

import mx.core.IUITextField;
use namespace mx.core.mx_internal;

 

   message +="Press Yes to continue or No to cancel";
    }
    if(message.length>0){
     Alert.yesLabel="Yes"
      var alert:Alert=Alert.show(message,"Alert",3,null,alertHandlerForSO);     
     // alert.mx_internal::alertForm.mx_internal::textField.htmlText = message;
      IUITextField(alert.alertForm.textField).htmlText = message;
    }

 

 

 

========================================================

 有这个想法,然后看了下flex的Alert的源码,发现alert出来的按钮、内容文本框其实都在一个AlertForm类实例中,这个实例在Alert类成员中的定义是:


/**
    *  @private
    *  The internal AlertForm object that contains the text, icon, and buttons
    *  of the Alert control.
    */
    mx_internal var alertForm:AlertForm;

而其内容文本框在AlertForm中的定义是:


/**
     *  The UITextField that displays the text of the Alert control.
     */
    mx_internal var textField:IUITextField;

ok,相信大家都知道该怎么做了,也就是在mx_internal命名空间下,把这个textfield提取出来,设置其htmltext即可,当然,你也可以进行其他的操作。
源码如下:


var alert:Alert = Alert.show("", "提示");
var tf:IUITextField = alert.mx_internal::alertForm.mx_internal::textField;
tf.autoSize = TextFieldAutoSize.CENTER;
tf.htmlText = "<a href='http://www.asarea.cn' target='_blank'><b><font color='#ffffff' size='13'>欢迎访问ASAREA</font></b></a>";

文章来自: 闪客居(www.flashas.net) 详文参考:http://flashas.net/as/20090414/4029.html

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值