[flash 8] selector de color


hola todos,

estoy intentando hacer un selector de color como el que tiene flash.

me bajado una peli pero solo me funciona en flash 6 y yo lo necesito en
flash 8.

alguien me puede ayudar?

aqu� os pongo el c�digo en donde creo que est� el error, si alguien se anima
y quiere mirarlo fondo le paso la peli.

saludos :)


el codigo est� en un frame (por si ayuda)


#initclip
colorboxclass = function () {
this.go();
};
colorboxclass.prototype = new movieclip();
object.registerclass("colorbox",colorboxclass);
colorboxclass.prototype.setchangehandler = function(chng, obj) {
this.handlerobj = (obj == undefined) ? this._parent : obj;
this.changehandler = chng;
};
colorboxclass.prototype.executecallback = function() {
this.handlerobj[this.changehandler](this);
};
setmycolor = function () {
this._parent._parent.rgbobj = this.rgbobj;
this._parent._parent.hexobj = this.hexobj;
this._parent._parent.hexvalue =
"#"+this.hexobj.r+this.hexobj.g+this.hexobj.b;
this._parent._parent.rgbvalue = (this.rgbobj.r << 16 | this.rgbobj.g << 8 |
this.rgbobj.b);
this._parent._parent.executecallback();
};
colorboxclass.prototype.getrgbobj = function() {
return (this.rgbobj);
};
colorboxclass.prototype.gethexobj = function() {
return (this.hexobj);
};
colorboxclass.prototype.getrgbvalue = function() {
return (this.rgbvalue);
};
colorboxclass.prototype.gethexvalue = function() {
return (this.hexvalue);
};
colorboxclass.prototype.setmuestracolor = function(obj, hex) {
var rgb = (obj.r << 16 | obj.g << 8 | obj.b);
this.output.text = hex;
this.muestracolor.setrgb(rgb);
};
function setcolorfocus() {
this._parent._parent.colorfocus._x = this._x;
this._parent._parent.colorfocus._y = this._y;
this._parent._parent.colorfocus._visible = true;
this._parent._parent.setmuestracolor(this.rgbobj,
"#"+this.hexobj.r+this.hexobj.g+this.hexobj.b);
}
function killcolorfocus() {
this._parent._parent.colorfocus._visible = false;
}
hex = ["00", "33", "66", "99", "cc", "ff"];
rgbs = [0, 51, 102, 153, 204, 255];
xtracolors = [{r:0, g:0, b:0, hr:"00", hg:"00", hb:"00"}, {r:51, g:51, b:51,
hr:"33", hg:"33", hb:"33"}, {r:102, g:102, b:102, hr:"66", hg:"66",
hb:"66"}, {r:153, g:153, b:153, hr:"99", hg:"99", hb:"99"}, {r:204, g:204,
b:204, hr:"cc", hg:"cc", hb:"cc"}, {r:255, g:255, b:255, hr:"ff", hg:"ff",
hb:"ff"}, {r:255, g:0, b:0, hr:"ff", hg:"00", hb:"00"}, {r:0, g:255, b:0,
hr:"00", hg:"ff", hb:"00"}, {r:0, g:0, b:255, hr:"00", hg:"00", hb:"ff"},
{r:255, g:255, b:0, hr:"ff", hg:"ff", hb:"00"}, {r:0, g:255, b:255, hr:"00",
hg:"ff", hb:"ff"}, {r:255, g:0, b:255, hr:"ff", hg:"00", hb:"ff"}];
colorboxclass.prototype.go = function() {
this.rgbobj = {};
this.hexobj = {};
this.hexvalue = 0;
this.rgbvalue = 0;
this._visible = this.visiblewhenload;
if (this.changehandler.length>0) {
this.setchangehandler(this.changehandler);
}
var cols = 18;
var c = 0;
var r = 0;
var n = 0;
var basex = 6+16;
var basey = 26;
this.muestracolor = new color(this.muestra);
this.createemptymovieclip("content", 1);
(var = 0; i<6; i++) {
(var j = 0; j<6; j++) {
(var k = 0; k<6; k++) {
this.content.attachmovie("sq", "sq"+n, n+1);
var clip = this.content["sq"+n];
clip.usehandcursor = false;
clip.onrollover = setcolorfocus;
clip.onrollout = killcolorfocus;
clip.onpress = setmycolor;
clip.rgbobj = {r:rgbs , g:rgbs[k], b:rgbs[j]};
clip.hexobj = {r:hex
, g:hex[k], b:hex[j]};
n++;
clip._x = (c*8)+basex;
clip._y = (r*8)+basey;
c++;
if (c == 6) {
c = 0;
r++;
if (r == 6) {
r = 0;
basex += 48;
if (basex == 166) {
basex = 6+16;
basey += 48;
}
}
}
var mycolor = (rgbs << 16 | rgbs[k] << 8 | rgbs[j]);
var tempcolor = new color(clip);
tempcolor.setrgb(mycolor);
}
}
}
(var = 0; i<xtracolors.length; i++) {
this.content.attachmovie("sq", "sq"+n, n+1);
var clip = this.content["sq"+n];
clip.usehandcursor = false;
clip.onrollover = setcolorfocus;
clip.onrollout = killcolorfocus;
clip.onpress = setmycolor;
clip.rgbobj = {r:xtracolors
.r, g:xtracolors .g, b:xtracolors.b};
clip.hexobj = {r:xtracolors .hr, g:xtracolors.hg,
b:xtracolors .hb};
n++;
clip._x = 6;
clip._y = i*8+26;
var mycolor = (xtracolors
.r << 16 | xtracolors .g << 8 |
xtracolors
.b);
var tempcolor = new color(clip);
tempcolor.setrgb(mycolor);
}
this._x = math.round(this._x);
this._y = math.round(this._y);
this.dummy.usehandcursor = false;
this.colorfocus._visible = false;
this.coloffocus.swapdepths(content);
};
#endinitclip
output.onchanged = function() {
if (this.text.charat(0) != "#") {
this.text += "#";
}
hexobj.r = this.text.substr(1, 2);
rgbobj.r = parseint("0x"+hexobj.r);
hexobj.g = this.text.substr(3, 2);
rgbobj.g = parseint("0x"+hexobj.g);
hexobj.b = this.text.substr(5, 2);
rgbobj.b = parseint("0x"+hexobj.b);
hexvalue = "#"+hexobj.r+hexobj.g+hexobj.b;
rgbvalue = (rgbobj.r << 16 | rgbobj.g << 8 | rgbobj.b);
setmuestracolor(rgbobj, hexvalue);
this.text = this.text.touppercase();
};
mylist = {};
mylist.onkeydown = function() {
if (key.getcode() == 13) {
executecallback();
}
};
key.addlistener(mylist);
stop();





More discussions in Foro en espaƱol


adobe

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support