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=""; } } }?