如何利用组件在flash中加调色板

来源:互联网 发布:办公室做数据是做什么 编辑:程序博客网 时间:2024/06/05 00:53
组件->User Interface->ColorPicker拉到库中


import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
var clp:ColorPicker=new ColorPicker();
var wb_txt:TextField=new TextField();
var wbys:TextFormat=new TextFormat();
addChild(wb_txt);
addChild(clp);
wb_txt.text="这是设置颜色板";
wbys.size=14
wb_txt.setTextFormat(wbys);
wb_txt.x=200;
wb_txt.y=200;
clp.x=wb_txt.x+wb_txt.width+clp.width;
clp.y=wb_txt.y;
clp.addEventListener(ColorPickerEvent.CHANGE,cd);
function cd(event):void
{
var asd:String = new String();
asd = "0x"+clp.hexValue;
trace(asd);
wbys.color=asd;//clp.selectedColor;
trace(clp.selectedColor);
trace(clp.hexValue);
wb_txt.setTextFormat(wbys);
}

原创粉丝点击