PDA

View Full Version : ColorBox AS Help


TheHazelOp
02-14-2004, 03:25 AM
I am getting script errors witin the following code. If you can find the error please post it. thnx

#initclip
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);
} // End of the function
function killColorFocus()
{
this._parent._parent.colorFocus._visible = false;
} // End of the function
ColorBoxClass = function ()
{
this.go();
};
ColorBoxClass.prototype = new MovieClip();
Object.registerClass("colorBox", colorBoxClass);
ColorBoxClass.prototype.setChangeHandler = function (chng, obj)
{
this.handlerObj = obj == super ? 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();
_root.color1 = "0x" + this._parent._parent.color_code.slice(1);
_root.change_color = 1;
_root.site_color_setcookie();
};
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);
};
hex = ["14", "28", "3C", "50", "64", "78"];
rgbs = [20, 40, 60, 80, 100, 120];
xtraColors = [{r:112, g:100, b:86, hr:"70", hg:"64", hb:"56"}, {r:70, g:70, b:70, hr:"46", hg:"46", hb:"46"}, {r:102, g:102, b:102, hr:"66", hg:"66", hb:"66"}, {r:140, g:140, b:140, hr:"8C", hg:"8C", hb:"8C"}, {r:120, g:100, b:100, hr:"78", hg:"64", hb:"64"}, {r:80, g:80, b:100, hr:"50", hg:"50", hb:"64"}, {r:170, g:85, b:0, hr:"AA", hg:"55", hb:"00"}, {r:100, g:80, b:80, hr:"64", hg:"50", hb:"50"}, {r:120, g:120, b:80, hr:"78", hg:"78", hb:"50"}, {r:28, g:82, b:108, hr:"1C", hg:"52", hb:"6C"}, {r:60, g:80, b:60, hr:"3C", hg:"50", hb:"3C"}, {r:80, g:60, b:60, hr:"50", hg:"3C", hb:"3C"}];
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);
} // end if
var cols = 18;
var c = 0;
var r = 0;
var n = 0;
var basex = 22;
var basey = 26;
this.muestraColor = new Color(this.muestra);
this.createEmptyMovieClip("content", 1);
var i = 0;
while (i < 6)
{
var j = 0;
while (j < 6)
{
var k = 0;
while (k < 6)
{
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[i], g:rgbs[k], b:rgbs[j]};
clip.hexObj = {r:hex[i], 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 = basex + 48;
if (basex == 166)
{
basex = 22;
basey = basey + 48;
} // end if
} // end if
} // end if
var mycolor = rgbs[i] << 16 | rgbs[k] << 8 | rgbs[j];
var tempColor = new Color(clip);
tempColor.setRGB(mycolor);
k++;
} // end while
j++;
} // end while
i++;
} // end while
var i = 0;
while (i < xtracolors.length)
{
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[i].r, g:xtraColors[i].g, b:xtraColors[i].b};
clip.hexObj = {r:xtraColors[i].hr, g:xtraColors[i].hg, b:xtraColors[i].hb};
n++;
clip._x = 6;
clip._y = i * 8 + 26;
var mycolor = xtraColors[i].r << 16 | xtraColors[i].g << 8 | xtraColors[i].b;
var tempColor = new Color(clip);
tempColor.setRGB(mycolor);
i++;
} // end while
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

HelpVirius
02-14-2004, 10:18 AM
well, im pretty sure that to close a function u need a }; so like here ya got:

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);
} // End of the function

which needs to be:
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);
}; // End of the function

TheHazelOp
02-14-2004, 01:19 PM
Thnx i will give it a try.

Another question. If i make a flash site that is exactly identical to another flash site out there... But all the code redone and a-z rebuilt from scratch is it considerd stolen?

TheHazelOp
02-14-2004, 01:29 PM
does that include

} //End If & //End While


im still getting errors

:-(

splict
02-14-2004, 01:36 PM
Originally posted by TheHazelOp
Another question. If i make a flash site that is exactly identical to another flash site out there... But all the code redone and a-z rebuilt from scratch is it considerd stolen?
that depends on who you are worried about considering it stolen.

HelpVirius
02-14-2004, 01:40 PM
im pretty sure that it dont apply to while's or if's but im not a pro :) i dunt think ud get it trouble if you put a disclaimer of the site saying that it is the other dudes idea and your site is a remake/remodle of it.

TheHazelOp
02-14-2004, 06:25 PM
okay cool. im still having problems with that AScript. it is not drawing the pallette of colors when published...