首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

As3 TextArea的htmlText 属性(给每行接收的文本授予不同色彩)

2012-12-28 
As3 TextArea的htmlText 属性(给每行接收的文本赋予不同色彩)package {import fl.events.ColorPickerEvent

As3 TextArea的htmlText 属性(给每行接收的文本赋予不同色彩)

package {import fl.events.ColorPickerEvent;import flash.geom.ColorTransform;import flash.text.TextFormat;import flash.display.MovieClip;import flash.events.MouseEvent;public class colors extends MovieClip {   public function colors() {    color.showTextField=true;//ColorPicker组件是否显示内部文本字段    color.addEventListener(ColorPickerEvent.ITEM_ROLL_OVER,onChange);    send.addEventListener(MouseEvent.CLICK,onclick); //send为输入文本框   }   function onChange(e:ColorPickerEvent) {    var wbys:TextFormat=wb_txt.getTextFormat();    wbys.color=color.selectedColor;    wb_txt.setTextFormat(wbys);    wb_txt.textColor=color.selectedColor;   }   function onclick(e:MouseEvent) {       var txt:String="<font color='#"+color.hexValue+"'>"+wb_txt.text+"</font><br>";    contents.htmlText += txt; //contents为接收文本域    trace("文本内容:"+txt);    wb_txt.text="";   }}}
?

热点排行