Combined Code
movieClip 2 eventHandler {
}
movieClip 4 brushTool {
frame 1 {
this.onEnterFrame = function () {
mcColor = new Color(this);
mcColor.setRGB(_root.brushColor);
};
}
}
movieClip 6 {
}
movieClip 7 brushTip {
frame 1 {
this.onEnterFrame = function () {
movement = _parent._xmouse - this._x;
this._x += movement * 0.9;
movement = _parent._ymouse - this._y;
this._y += movement * 0.9;
};
}
}
frame 1 {
this.onLoad = function () {
this.moveTo(_root.brushTip._x, _root.brushTip._y);
};
this.onEnterFrame = function () {
if (Key.isDown(40) && brushSize > 1) {
_root.brushTip._height -= 5;
_root.brushTip._width -= 5;
}
if (Key.isDown(38)) {
_root.brushTip._height += 5;
_root.brushTip._width += 5;
}
if (Key.isDown(32)) {
this.moveTo(_root.brushTip._x - 1, _root.brushTip._y - 1);
}
brushSize = _root.brushTip._height;
if (Key.isDown(1)) {
this.lineStyle(_root.brushSize, _root.brushColor, 100);
this.lineTo(_root.brushTip._x, _root.brushTip._y);
}
};
}
instance of movieClip 2 eventHandler {
onClipEvent (load) {
_root.brushSize = _root.brushTip._height;
_root.r = random(256);
_root.g = random(256);
_root.b = random(256);
hexR = _root.r.toString(16);
hexG = _root.g.toString(16);
hexB = _root.b.toString(16);
hex_color = hexR + hexG + hexB;
_root.brushColor = '0x' + hex_color;
this.moveTo(_root.brushTip._x, _root.brushTip._y);
this.lineStyle(_root.brushSize, _root.brushColor, 100);
}
onClipEvent (enterFrame) {
if (Key.isDown(81) && _root.r < 256) {
++_root.r;
hexR = _root.r.toString(16);
}
if (Key.isDown(65) && _root.r > 1) {
--_root.r;
if (_root.r > 8) {
hexR = _root.r.toString(16);
} else {
hexR = _root.r.toString(16);
hexR = '0' + hexR;
}
}
if (Key.isDown(87) && _root.g < 256) {
++_root.g;
hexG = _root.g.toString(16);
}
if (Key.isDown(83) && _root.g > 1) {
--_root.g;
if (_root.g > 8) {
hexG = _root.g.toString(16);
} else {
hexG = _root.g.toString(16);
hexG = '0' + hexG;
}
}
if (Key.isDown(69) && _root.b < 256) {
++_root.b;
hexB = _root.b.toString(16);
}
if (Key.isDown(68) && _root.b > 1) {
--_root.b;
if (_root.b > 8) {
hexB = _root.b.toString(16);
} else {
hexB = _root.b.toString(16);
hexB = '0' + hexB;
}
}
hex_color = hexR + hexG + hexB;
_root.brushColor = '0x' + hex_color;
this.lineStyle(_root.brushSize, _root.brushColor, 100);
}
}