纯代码色盘-----------------------听说名字不长没人看的?????????
做涂鸦板时写的,也许不是最简方法,当练习了
var col_str:String;
var cnt = 0;
var unit = 10;
for (col_r=0; col_r<6; col_r++) {
for (col_g=0; col_g<6; col_g++) {
for (col_b=0; col_b<6; col_b++) {
var r_str, g_str, b_str:String;
r_str = (col_r*51).toString(16);
g_str = (col_g*51).toString(16);
b_str = (col_b*51).toString(16);
if (r_str.length<2) {
r_str = "0"+r_str;
}
if (g_str.length<2) {
g_str = "0"+g_str;
}
if (b_str.length<2) {
b_str = "0"+b_str;
}
col_str = "0x"+r_str+g_str+b_str;
this.createEmptyMovieClip("slot"+cnt, cnt);
if (col_r<3) {
this["slot"+cnt]._x = col_g*unit+col_r*6*unit;
this["slot"+cnt]._y = col_b*unit;
} else {
this["slot"+cnt]._x = col_g*unit+(col_r-3)*6*unit;
this["slot"+cnt]._y = col_b*unit+unit*6;
}
this["slot"+cnt].lineStyle(0.5, 0x000000, 100);
this["slot"+cnt].beginFill(col_str, 100);
this["slot"+cnt].moveTo(0, 0);
this["slot"+cnt].lineTo(0, unit);
this["slot"+cnt].lineTo(unit, unit);
this["slot"+cnt].lineTo(unit, 0);
this["slot"+cnt].lineTo(0, 0);
this["slot"+cnt].endFill();
this["slot"+cnt].col = col_str;
this["slot"+cnt].onRollOver = function() {
this._parent.form._visible = true;
this._parent.form._x = this._x;
this._parent.form._y = this._y;
};
this["slot"+cnt].onRollOut = function() {
this._parent.form._visible = false;
};
this["slot"+cnt].onDragOver = function() {
trace(1)
this._parent.form._visible = true;
this._parent.form._x = this._x;
this._parent.form._y = this._y;
};
this["slot"+cnt].onDragOut = function() {
this._parent.form._visible = false;
};
cnt++;
}
}
}
this.createEmptyMovieClip("form", cnt);
this.form.lineStyle(0.5, 0xFFFFFF, 100);
this.form.moveTo(0, 0);
this.form.lineTo(0, unit);
this.form.lineTo(unit, unit);
this.form.lineTo(unit, 0);
this.form.lineTo(0, 0);
this.form._visible = false;