Convert fra 5 til 7 action script 1
Fejl:**Error** Scene=Scene 1, layer=Objects, frame=1:Line 19: Left side of assignment operator must be variable or property.
eval("/:Slot"+count+"Color") = new Color( eval("Slot"+count) );
**Error** Scene=Scene 1, layer=Objects, frame=1:Line 20: Left side of assignment operator must be variable or property.
eval("/:Slot"+count+"ColorTransform") = new Object;
Total ActionScript Errors: 2 Reported Errors: 2
Code:
eval("/:Slot"+count+"Color") = new Color( eval "Slot"+count) );
eval("/:Slot"+count+"ColorTransform") = new Object;
Hele Coden:
onClipEvent (load) {
peak = 255;
colorPalette = "multi";
RValues = new Array (peak,peak,0,0,0,peak,peak,peak);
GValues = new Array (0,peak,peak,peak,0,0,0,0);
BValues = new Array (0,0,0,peak,peak,peak,0,0);
numOfCols = 6;
colWidth = Palette._width / numOfCols;
oneColPercent = colWidth/100;
// color objects
/:PaletteColor = new Color( Palette );
/:PaletteColorTransform = new Object;
/:PreviewColor = new Color( Preview );
/:PreviewColorTransform = new Object;
/:Preview2Color = new Color( Preview2 );
/:Preview2ColorTransform = new Object;
// slots
for (count = 1; count <= 8; count ++) {
eval("/:Slot"+count+"Color") = new Color( eval("Slot"+count) );
eval("/:Slot"+count+"ColorTransform") = new Object;
}
// ----------------------------------------
function getColor(myVar) {
// which column?
column = int(currX / colWidth);
// percent in current column?
columnPercent = (currX - (Palette._x + (column * colWidth))) / oneColPercent;
// percentage between peaks
difference = eval(myVar)[column+1] - eval(myVar)[column];
if (difference == peak) {
currValue = int(columnPercent * (peak/100));
} else if (difference == 0 - peak) {
currValue = int((100 - columnPercent) * (peak/100));
} else {
currValue = eval(myVar)[column];
}
return int(currValue);
}
// ----------------------------------------
function getBrightness(currValue) {
// level of darkness / brightness
if (colorPalette eq "white") {
maxValue = peak;
minValue = 0;
oneValuePercent = (maxValue - minValue)/100;
curPercent = 100 - (currY * (Preview._height / 100));
currValue = curPercent * oneValuePercent;
} else {
if (currY < Preview._height/2) {
maxValue = peak;
minValue = currValue;
oneValuePercent = (maxValue - minValue)/100;
curPercent = 100 - (currY * ((Preview._height*2) / 100));
currValue += curPercent * oneValuePercent;
} else {
maxValue = currValue;
minValue = 0;
oneValuePercent = (maxValue - minValue)/100;
curPercent =( currY-(Preview._height/2)) * ((Preview._height*2) / 100);
currValue -= curPercent * oneValuePercent;
}
}
return int(currValue);
}
// ----------------------------------------
function setColor() {
this.currX = Cross._x;
this.currY = Cross._y;
R2 = getColor("RValues");
/:R = getBrightness(R2);
G2 = getColor("GValues");
/:G = getBrightness(G2);
B2 = getColor("BValues");
/:B = getBrightness(B2);
_root.colorize("Preview",/:R,/:G,/:B,/:ALPHA);
_root.colorize("Preview2",R2,G2,B2,100);
// display hex value
/:RGBHEX = /:hexValue[/:R] + /:hexValue[/:G] + /:hexValue[/:B];
hexText = "#" + /:RGBHEX;
rgbText = "R:"+/:R+" G:"+/:G+" B:"+/:B;
}
// ----------------------------------------
function restoreColor(num) {
if (eval("Slot" + num).colorPalette ne "") {
switchColorMode(eval("Slot" + num).colorPalette);
/:R = eval("Slot" + num).R;
/:G = eval("Slot" + num).G;
/:B = eval("Slot" + num).B;
/:ALPHA = eval("Slot" + num).ALPHA;
Cross._x = eval("Slot" + num).X;
Cross._y = eval("Slot" + num).Y;
SliderB._y = Cross._y;
SliderA._y = (100 - /:ALPHA) * ((SliderA.bottomBorder - SliderA.topBorder)/100);
setColor();
}
}
// ---------------------------------------
function switchColorMode(mode) {
if (mode eq "multi") {
colorPalette = "multi";
Palette.gotoAndStop(1);
_root.Colorize("Palette",100,100,100,100);
RValues = new Array (peak,peak,0,0,0,peak,peak,peak);
GValues = new Array (0,peak,peak,peak,0,0,0,0);
BValues = new Array (0,0,0,peak,peak,peak,0,0);
} else if (mode eq "white") {
colorPalette = "white";
Palette.gotoAndStop(2);
_root.Colorize("Palette",100,100,100,100);
RValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
GValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
BValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
} else if (mode eq "red") {
colorPalette = "red";
Palette.gotoAndStop(2);
_root.Colorize("Palette",255,0,0,100);
RValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
GValues = new Array (0,0,0,0,0,0,0,0);
BValues = new Array (0,0,0,0,0,0,0,0);
} else if (mode eq "yellow") {
colorPalette = "yellow";
Palette.gotoAndStop(2);
_root.Colorize("Palette",255,255,0,100);
RValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
GValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
BValues = new Array (0,0,0,0,0,0,0,0);
} else if (mode eq "green") {
colorPalette = "green";
Palette.gotoAndStop(2);
_root.Colorize("Palette",0,255,0,100);
RValues = new Array (0,0,0,0,0,0,0,0);
GValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
BValues = new Array (0,0,0,0,0,0,0,0);
} else if (mode eq "cyan") {
colorPalette = "cyan";
Palette.gotoAndStop(2);
_root.Colorize("Palette",0,255,255,100);
RValues = new Array (0,0,0,0,0,0,0,0);
GValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
BValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
} else if (mode eq "blue") {
colorPalette = "blue";
Palette.gotoAndStop(2);
_root.Colorize("Palette",0,0,255,100);
RValues = new Array (0,0,0,0,0,0,0,0);
GValues = new Array (0,0,0,0,0,0,0,0);
BValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
} else if (mode eq "purple") {
colorPalette = "purple";
Palette.gotoAndStop(2);
_root.Colorize("Palette",255,0,255,100);
RValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
GValues = new Array (0,0,0,0,0,0,0,0);
BValues = new Array (peak,peak,peak,peak,peak,peak,peak,peak);
}
setColor();
}
setColor();
}
