Frame 1
stop();
_quality = "LOW";
Frame 2
i = 0;
while (i < mas) {
po = createEmptyMovieClip("drawing" + i, i);
po.lineStyle(1);
po.lineTo(0, 600);
po._x = (sw = Stage.width / 2);
po._y = (sh = Stage.height / 2);
po._rotation = (360 / mas) * i;
po.oldx = po._xmouse + sw;
po.oldy = po._ymouse + sh;
po.onEnterFrame = function () {
if (Key.isDown(1)) {
lineStyle(4, "0x" + col);
moveTo(this.oldx, this.oldy);
lineTo(this._xmouse + sw, this._ymouse + sh);
}
this.oldx = this._xmouse + sw;
this.oldy = this._ymouse + sh;
};
i++;
}
Instance of Symbol 6 MovieClip [etfColorPickerSymbol] in Frame 2
//component parameters
onClipEvent (construct) {
}
Symbol 6 MovieClip [etfColorPickerSymbol] Frame 1
#initclip 1
function etfColorPickerCalcClass(dir, red_range, yellow_range, green_range, cyan_range, blue_range, magenta_range, white_range, black_range) {
this.dir = dir;
this.red_range = red_range;
this.yellow_range = yellow_range;
this.green_range = green_range;
this.cyan_range = cyan_range;
this.blue_range = blue_range;
this.magenta_range = magenta_range;
this.white_range = white_range;
this.black_range = black_range;
this.x = 0;
this.y = 0;
this.val1 = 0;
this.val2 = 0;
this.val3 = 0;
this.range = null;
}
etfColorPickerCalcClass.prototype.helpValue = function (dir) {
this.x = this.x - this.range.min;
this.val2 = int(((this.range.absDifference() - this.x) / this.range.absDifference()) * 255);
if (!dir) {
this.val2 = 255 - this.val2;
}
if ((this.y >= this.white_range.min) && (this.y <= this.white_range.max)) {
var _local2;
_local2 = (this.y * -1) + this.white_range.absDifference();
this.val2 = this.val2 + int((_local2 / this.white_range.absDifference()) * (255 - this.val2));
this.val3 = int((_local2 / this.white_range.absDifference()) * 255);
}
if ((this.y >= this.black_range.min) && (this.y <= this.black_range.max)) {
this.val2 = this.val2 - int(((this.y - this.black_range.absDifference()) / 20) * this.val2);
this.val1 = this.val1 - int(((this.y - this.black_range.absDifference()) / 20) * 255);
}
};
etfColorPickerCalcClass.prototype.Calculate = function (x, y) {
if (this.dir == 0) {
this.x = x;
this.y = y;
} else {
this.x = y;
this.y = x;
}
var _local3;
var _local4;
var _local2;
this.val1 = 255;
this.val2 = 0;
this.val3 = 0;
if ((this.x >= this.red_range.min) && (this.x <= this.red_range.max)) {
this.range = this.red_range;
this.helpValue(0);
_local3 = this.val1;
_local4 = this.val2;
_local2 = this.val3;
} else if ((this.x >= this.yellow_range.min) && (this.x <= this.yellow_range.max)) {
this.range = this.yellow_range;
this.helpValue(1);
_local3 = this.val2;
_local4 = this.val1;
_local2 = this.val3;
} else if ((this.x >= this.green_range.min) && (this.x <= this.green_range.max)) {
this.range = this.green_range;
this.helpValue(0);
_local3 = this.val3;
_local4 = this.val1;
_local2 = this.val2;
} else if ((this.x >= this.cyan_range.min) && (this.x <= this.cyan_range.max)) {
this.range = this.cyan_range;
this.helpValue(1);
_local3 = this.val3;
_local4 = this.val2;
_local2 = this.val1;
} else if ((this.x >= this.blue_range.min) && (this.x <= this.blue_range.max)) {
this.range = this.blue_range;
this.helpValue(0);
_local3 = this.val2;
_local4 = this.val3;
_local2 = this.val1;
} else if ((this.x >= this.magenta_range.min) && (this.x <= this.magenta_range.max)) {
this.range = this.magenta_range;
this.helpValue(1);
_local3 = this.val1;
_local4 = this.val3;
_local2 = this.val2;
}
return(((_local3 << 16) | (_local4 << 8)) | _local2);
};
function etfStdColorClass() {
this.rgbVal = 0;
}
etfStdColorClass.prototype.setRGB = function (rgbVal) {
this.rgbVal = rgbVal;
};
etfStdColorClass.prototype.getRGB = function () {
return(this.rgbVal);
};
etfStdColorClass.prototype.setColorObject = function (cObj) {
this.rgbVal = cObj.getRGB();
};
etfStdColorClass.prototype.getColorObject = function () {
var _local2 = new Color();
_local2.setRGB(this.rgbVal);
return(_local2);
};
etfStdColorClass.prototype.applyTo = function (mc) {
var _local2 = new Color(mc);
_local2.setRGB(this.rgbVal);
};
_global.etfRangeClass = function (min, max) {
this.min = min;
this.max = max;
};
etfRangeClass.prototype = new Object();
etfRangeClass.prototype.difference = function () {
return(this.max - this.min);
};
etfRangeClass.prototype.absDifference = function () {
return(Math.abs(this.difference()));
};
_global.decimalToBase = function (decimalNr, cBase, cCharpool) {
var _local2 = "";
var _local3 = Math.pow(2, cBase) - 1;
if (decimalNr == 0) {
_local2 = cCharpool.charAt(0);
}
while (decimalNr != 0) {
_local2 = cCharpool.charAt(decimalNr & _local3) + _local2;
decimalNr = decimalNr >> cBase;
}
return(_local2);
};
_global.baseToDecimal = function (stringNr, cBase, cCharpool) {
var _local2;
var _local4;
var _local3;
var _local1;
_local1 = 0;
_local2 = 0;
while (_local2 < stringNr.length) {
_local4 = stringNr.charAt(_local2);
_local3 = cCharpool.indexOf(_local4);
_local1 = _local1 << cBase;
_local1 = _local1 | _local3;
_local2++;
}
return(_local1);
};
_global.hex = function (decNr) {
return(decimalToBase(decNr, 4, "0123456789ABCDEF"));
};
_global.bin = function (decNr) {
return(decimalToBase(decNr, 1, "01"));
};
_global.oct = function (decNr) {
return(decimalToBase(decNr, 3, "01234567"));
};
_global.hexToDec = function (stringNr) {
return(baseToDecimal(stringNr, 4, "0123456789ABCDEF"));
};
_global.octToDec = function (stringNr) {
return(baseToDecimal(stringNr, 3, "01234567"));
};
_global.binToDec = function (stringNr) {
return(baseToDecimal(stringNr, 1, "01"));
};
_global.rndStr = function (lenStr, rangeAsciiMin, rangeAsciiMax) {
var _local3 = "";
var _local2;
_local2 = 0;
while (_local2 < lenStr) {
_local3 = _local3 + chr(this.rndNr(rangeAsciiMin, rangeAsciiMax));
_local2++;
}
return(_local3);
};
_global.rndNr = function (nrMin, nrMax) {
return(int(nrMin + (Math.random() * (nrMax - nrMin))));
};
function etfColorPickerClass() {
this.init();
}
etfColorPickerClass.prototype = new etfStdColorClass();
Object.registerClass("etfColorPickerSymbol", etfColorPickerClass);
etfColorPickerClass.prototype.init = function () {
this.pickerMC = this.pane.pickerMC;
var _local5 = new etfRangeClass(0, 21.5);
var _local7 = new etfRangeClass(21.5, 47.5);
var _local2 = new etfRangeClass(47.5, 65);
var _local3 = new etfRangeClass(65, 86.5);
var _local6 = new etfRangeClass(86.5, 108);
var _local9 = new etfRangeClass(108, 130);
var _local8 = new etfRangeClass(0, 20);
var _local4 = new etfRangeClass(20, 40);
this.calcClass = new etfColorPickerCalcClass(0, _local5, _local7, _local2, _local3, _local6, _local9, _local8, _local4);
this.pickObj = new Object();
this.pickObj.refRoot = this;
this.pickObj.downflg = false;
this.pickObj.x = 0;
this.pickObj.y = 0;
this.pickObj.watch("x", this.pickedCallback);
this.pickObj.watch("y", this.pickedCallback);
this.pane.onMouseMove = function () {
if (this.hitTest(_xmouse, _ymouse, true)) {
Mouse.hide();
this.pickerMC._visible = true;
this._parent.pickerPos();
} else {
Mouse.show();
this.pickerMC._visible = false;
}
};
this.pane.onMouseDown = function () {
if (this.hitTest(_xmouse, _ymouse, true)) {
this._parent.pickObj.downflg = true;
this._parent.pickerPos();
}
};
this.pane.onDragOver = function () {
if (this.hitTest(_xmouse, _ymouse, true)) {
this._parent.pickObj.downflg = true;
this._parent.pickerPos();
}
};
this.pane.onMouseUp = function () {
if (this.hitTest(_xmouse, _ymouse, true)) {
this._parent.pickObj.downflg = false;
this._parent.pickerPos();
}
};
this.pane.onDragOut = function () {
if (this.hitTest(_xmouse, _ymouse, true)) {
this._parent.pickObj.downflg = false;
this._parent.pickerPos();
}
};
};
etfColorPickerClass.prototype.pickedCallback = function (id, oldval, newval) {
if ((((this.downflg && (this.x >= 0)) && (this.y >= 0)) && (this.x <= this.refRoot._width)) && (this.y <= this.refRoot._height)) {
this.refRoot.setRGB(this.refRoot.calcClass.Calculate(this.x, this.y));
_root.col = this.refRoot.calcClass.Calculate(this.x, this.y).toString(16);
}
return(newval);
};
etfColorPickerClass.prototype.pickerPos = function () {
this.pickerMC._x = this.pane._xmouse;
this.pickerMC._y = this.pane._ymouse;
this.pickObj.x = this.pane._xmouse;
this.pickObj.y = this.pane._ymouse;
};
#endinitclip
Symbol 12 Button
on (release) {
nextFrame();
}
Symbol 20 Button
on (release) {
getURL ("http://john.tringham.co.uk", "_blank");
}
Symbol 24 Button
on (release) {
o = 0;
while (o < _root.mas) {
_root["drawing" + o].removeMovieClip();
_root.prevFrame();
_root.clear();
o++;
}
}