Frame 1
function square(myClip, mode, x, y, w, h, primaryColor, secondaryColor) {
with (myClip) {
if (mode == "f") {
beginFill(primaryColor);
} else if (mode == "h") {
lineStyle(0, primaryColor);
} else if (mode == "fs") {
lineStyle(1, secondaryColor);
beginFill(primaryColor);
}
moveTo(x, y);
lineTo(x + w, y);
lineTo(x + w, y + h);
lineTo(x, y + h);
lineTo(x, y);
if ((mode == "f") || (mode == "fs")) {
endFill();
}
}
}
function circle(clip, mode, x, y, r, primaryColor, secondaryColor) {
var u = (r * 0.4086);
var v = (r * 0.7071);
with (clip) {
if (mode == "f") {
beginFill(primaryColor);
} else if (mode == "h") {
lineStyle(0, primaryColor);
} else if (mode == "fs") {
lineStyle(1, secondaryColor);
beginFill(primaryColor);
}
moveTo(x - r, y);
curveTo(x - r, y - u, x - v, y - v);
curveTo(x - u, y - r, x, y - r);
curveTo(x + u, y - r, x + v, y - v);
curveTo(x + r, y - u, x + r, y);
curveTo(x + r, y + u, x + v, y + v);
curveTo(x + u, y + r, x, y + r);
curveTo(x - u, y + r, x - v, y + v);
curveTo(x - r, y + u, x - r, y);
if ((mode == "f") || (mode == "fs")) {
endFill();
}
}
}
function adjustColor() {
r = rValue_txt.text;
g = gValue_txt.text;
b = bValue_txt.text;
myColor = ((r << 16) | (g << 8)) | b;
fColor = myColor;
sColor = myColor;
colorSwatch.clear();
square(colorSwatch, "fs", 20, 300, 30, 30, fColor, 3355443);
}
function drawingTools() {
d++;
totaldrawings++;
currentFrame_txt.text = d;
this.createEmptyMovieClip("drawing" + d, myDepth);
myDepth++;
this.createEmptyMovieClip("masking" + d, myDepth);
myDepth++;
myMask = this["masking" + d];
square(myMask, "f", 70, 0, 480, 340, 16776960);
cell = this["drawing" + d];
cell.setMask(myMask);
cell.onMouseDown = function () {
cell.active = true;
origX = this._xmouse;
origY = this._ymouse;
cell.moveTo(OrigX, OrigY);
eval (tool + "Down")();
};
cell.onMouseUp = function () {
cell.active = false;
eval (tool + "Up")();
};
}
function pencilDown() {
cell.lineStyle(pencilThick, sColor);
cell.onMouseMove = function () {
if (this.active == true) {
this.lineTo(this._xmouse, this._ymouse);
updateAfterEvent();
}
};
}
function pencilUp() {
}
function lineDown() {
cell.lineStyle(lineThick, sColor);
cell.createEmptyMovieClip("s", 1);
cell.onMouseMove = function () {
if (this.active == true) {
cell.s.clear();
cell.s.lineStyle(0, 13421772, 100);
cell.s.moveTo(OrigX, OrigY);
cell.s.lineTo(_xmouse, _ymouse);
updateAfterEvent();
}
};
}
function lineUp() {
cell.s.removeMovieClip();
cell.lineTo(_xmouse, _ymouse);
}
function boxDown() {
cell.createEmptyMovieClip("s", 1);
cell.s._x = this._xmouse;
cell.s._y = this._ymouse;
cell.onMouseMove = function () {
if (this.active == true) {
cell.s.clear();
square(cell.s, "h", 0, 0, this._xmouse - origX, this._ymouse - origY, 13421772);
}
};
}
function boxUp() {
cell.s.removeMovieClip();
w = this._xmouse - origX;
h = this._ymouse - origY;
if (fill == true) {
square(cell, "f", origX, origY, w, h, fColor);
} else {
square(cell, "h", origX, origY, w, h, sColor);
}
}
function circleDown() {
cell.createEmptyMovieClip("s", 1);
cell.s._x = this._xmouse;
cell.s._y = this._ymouse;
marqueestartX = this._xmouse - origX;
marqueestartY = this._ymouse - origY;
cell.onMouseMove = function () {
if (this.active == true) {
cell.s.clear();
marqueeWidth = this._xmouse - origX;
if (((this._ymouse < origY) && (this._xmouse > origX)) || ((this._xmouse < origX) && (this._ymouse > origY))) {
offsetY = marqueestartY - (marqueeWidth / 2);
direction = 1;
} else {
offsetY = marqueestartY + (marqueeWidth / 2);
direction = 2;
}
circle(cell.s, "h", marqueestartX + (marqueeWidth / 2), offsetY, marqueeWidth / 2, 13421772);
}
};
}
function circleUp() {
cell.s.removeMovieClip();
if (fill == true) {
if (direction == 1) {
circle(cell, "f", origX + (marqueeWidth / 2), origY - (marqueeWidth / 2), marqueeWidth / 2, sColor);
} else {
circle(cell, "f", origX + (marqueeWidth / 2), origY + (marqueeWidth / 2), marqueeWidth / 2, sColor);
}
} else if (direction == 1) {
circle(cell, "h", origX + (marqueeWidth / 2), origY - (marqueeWidth / 2), marqueeWidth / 2, sColor);
} else {
circle(cell, "h", origX + (marqueeWidth / 2), origY + (marqueeWidth / 2), marqueeWidth / 2, sColor);
}
marqueeWidth = 0;
}
function nextDrawing() {
if (playing == false) {
this["drawing" + d]._visible = false;
if (d == totalDrawings) {
drawingtools();
if (onionMode == true) {
onionView();
}
} else {
d++;
cell = this["drawing" + d];
if (d == totalDrawings) {
nextF.cross._visible = true;
}
this["drawing" + d]._visible = true;
currentFrame_txt.text = d;
if (onionMode == true) {
onionView();
}
}
}
}
function previousDrawing() {
if (playing == false) {
if (d > 1) {
nextF.cross._visible = false;
this["drawing" + d]._visible = false;
d--;
cell = this["drawing" + d];
this["drawing" + d]._visible = true;
currentFrame_txt.text = d;
if (onionMode == true) {
onionView();
}
}
}
}
function onionSkin() {
if (playing == false) {
if (onionMode == false) {
onionView();
} else {
onionHide();
}
}
}
function onionView() {
onionMode = true;
onion.checkMark._visible = true;
var i = 1;
while (i <= totalDrawings) {
this["drawing" + i]._visible = true;
this["drawing" + i]._alpha = 30;
i++;
}
this["drawing" + d]._alpha = 100;
}
function onionHide() {
onionMode = false;
onion.checkMark._visible = false;
var i = 1;
while (i <= totalDrawings) {
this["drawing" + i]._visible = false;
this["drawing" + i]._alpha = 100;
i++;
}
this["drawing" + d]._visible = true;
}
function removeAnimFunction() {
if (playing == false) {
_root["drawing" + d].clear();
}
}
function newProjectFunction() {
if (playing == false) {
var i = 1;
while (i <= totaldrawings) {
removeMovieClip("_root.drawing" + i);
removeMovieClip("_root.masking" + i);
i++;
}
myDepth = myDepth - (totaldrawings * 2);
nextF.cross._visible = true;
totaldrawings = 0;
d = 0;
drawingtools();
}
}
function showtime() {
if (playing == false) {
playing = true;
playback.checkMark._visible = true;
if (onionMode == true) {
onionHide();
}
go = setInterval(animation, 1000 / speed);
} else {
cell = this["drawing" + d];
if (d == totalDrawings) {
nextF.cross._visible = true;
} else {
nextF.cross._visible = false;
}
playing = false;
playback.checkMark._visible = false;
clearInterval(go);
}
}
function animation() {
if (reverseMode == false) {
_root["drawing" + d]._visible = false;
if (d < totalDrawings) {
d++;
} else {
d = 1;
}
currentFrame_txt.text = d;
_root["drawing" + d]._visible = true;
if (loop == false) {
if (d == totalDrawings) {
clearInterval(go);
playing = false;
playback.checkmark._visible = false;
nextF.cross._visible = true;
}
}
} else {
_root["drawing" + d]._visible = false;
if (d > 1) {
d--;
} else {
d = totalDrawings;
}
currentFrame_txt.text = d;
_root["drawing" + d]._visible = true;
if (loop == false) {
if (d == totalDrawings) {
clearInterval(go);
playing = false;
playback.checkmark._visible = false;
}
}
}
}
function loopFunction() {
if (loop == false) {
loop = true;
looping.checkMark._visible = true;
} else {
loop = false;
looping.checkMark._visible = false;
}
}
function reverseFunction() {
if (reverseMode == false) {
reverseMode = true;
reverseplay.checkMark._visible = true;
} else {
reverseMode = false;
reverseplay.checkMark._visible = false;
}
}
var myDepth = 1;
Frame 2
square(this, "fs", -1, -1, 70, 342, 13421772, 6710886);
square(this, "fs", -1, 341, 551, 60, 13421772, 6710886);
with (this) {
lineStyle(0, 6710886);
moveTo(-1, -1);
lineTo(550, -1);
lineTo(550, 401);
moveTo(-1, 40);
lineTo(69, 40);
moveTo(-1, 85);
lineTo(69, 85);
moveTo(-1, 130);
lineTo(69, 130);
moveTo(-1, 170);
lineTo(69, 170);
moveTo(-1, 210);
lineTo(69, 210);
lineStyle(0, 16777215);
moveTo(0, 41);
lineTo(68, 41);
moveTo(0, 86);
lineTo(68, 86);
moveTo(0, 131);
lineTo(68, 131);
moveTo(0, 171);
lineTo(68, 171);
moveTo(0, 211);
lineTo(68, 211);
lineStyle(0, 16777215);
moveTo(36, 131);
lineTo(36, 210);
lineStyle(0, 3355443);
moveTo(35, 131);
lineTo(35, 210);
lineStyle(0, 16777215);
moveTo(110, 341);
lineTo(110, 400);
moveTo(161, 341);
lineTo(161, 400);
moveTo(346, 341);
lineTo(346, 400);
moveTo(549, 341);
lineTo(549, 400);
lineStyle(0, 6710886);
moveTo(109, 341);
lineTo(109, 400);
moveTo(160, 341);
lineTo(160, 400);
moveTo(345, 341);
lineTo(345, 400);
}
var drawIconW = 20;
var drawIconH = 20;
var animIconW = 30;
var animIconH = 25;
var iconColorF = 16777215;
var iconColorS = 6710886;
var iconSThick = 0;
var emptyClipS = new Array();
emptyClipS[0] = new Array("pencilTool", "fs", 8, 55, drawIconW, drawIconH, 13421772, iconColorS);
emptyClipS[1] = new Array("lineTool", "fs", 8, 101, drawIconW, drawIconH, 13421772, iconColorS);
emptyClipS[2] = new Array("sHollow", "fs", 8, 181, drawIconW, drawIconH, 13421772, 3355443);
emptyClipS[3] = new Array("sFill", "fs", 42, 181, drawIconW, drawIconH, 10066329, 3355443);
emptyClipS[4] = new Array("red", "fs", 12, 225, 10, 10, 16711680, 3355443);
emptyClipS[5] = new Array("green", "fs", 12, 250, 10, 10, 65280, 3355443);
emptyClipS[6] = new Array("blue", "fs", 12, 275, 10, 10, 255, 3355443);
emptyClipS[7] = new Array("newproject", "fs", 120, 364, animIconW, 20, iconColorF, iconColorS);
emptyClipS[8] = new Array("remove", "fs", 175, 364, animIconW, 20, iconColorF, iconColorS);
emptyClipS[9] = new Array("previousF", "fs", 213, 364, 18, 20, iconColorF, iconColorS);
emptyClipS[10] = new Array("nextF", "fs", 275, 364, 18, 20, iconColorF, iconColorS);
emptyClipS[11] = new Array("colorSwatch", "fs", 20, 300, 30, 30, 52479, 3355443);
var i = 0;
while (i < emptyClipS.length) {
this.createEmptyMovieClip(emptyClipS[i][0], myDepth);
square(this[emptyClipS[i][0]], emptyClipS[i][1], emptyClipS[i][2], emptyClipS[i][3], emptyClipS[i][4], emptyClipS[i][5], emptyClipS[i][6], emptyClipS[i][7]);
myDepth++;
i++;
}
var iconCheckMarkYPos = 364;
var emptyClipSC = new Array();
emptyClipSC[0] = new Array("onion", "fs", 300);
emptyClipSC[1] = new Array("playback", "fs", 414);
emptyClipSC[2] = new Array("looping", "fs", 452);
emptyClipSC[3] = new Array("reverseplay", "fs", 490);
var i = 0;
while (i < emptyClipSC.length) {
this.createEmptyMovieClip(emptyClipSC[i][0], myDepth);
square(this[emptyClipSC[i][0]], emptyClipSC[i][1], emptyClipSC[i][2], iconCheckMarkYPos, animIconW, 20, iconColorF, iconColorS);
this[emptyClipSC[i][0]].createEmptyMovieClip("checkMark", 1);
with (this[emptyClipSC[i][0]].checkMark) {
lineStyle(0, 3355443);
moveTo(emptyClipSC[i][2] + 12, iconCheckMarkYPos - 10);
lineTo(emptyClipSC[i][2] + 15, iconCheckMarkYPos - 5);
lineTo(emptyClipSC[i][2] + 20, iconCheckMarkYPos - 15);
_visible = false;
}
myDepth++;
i++;
}
this.createEmptyMovieClip("cHollow", myDepth);
circle(cHollow, "fs", 19, 151, 10, 13421772, 3355443);
myDepth++;
this.createEmptyMovieClip("cFill", myDepth);
circle(cFill, "fs", 53, 151, 10, 10066329, 3355443);
myDepth++;
this.createEmptyMovieClip("selectedTool", myDepth);
with (selectedTool) {
beginFill(16777215);
moveTo(14, 42);
lineTo(24, 42);
lineTo(19, 48);
lineTo(14, 42);
endFill();
}
myDepth++;
with (pencilTool) {
lineStyle(1, 3355443);
moveTo(23, 62);
lineTo(21, 60);
lineTo(11, 70);
lineTo(13, 72);
lineTo(23, 62);
lineStyle(1, 0);
lineTo(25, 58);
lineTo(21, 60);
lineTo(23, 62);
}
with (lineTool) {
lineStyle(2, 3355443);
moveTo(13, 118);
lineTo(23, 105);
}
with (previousF) {
lineStyle(0, 13421772);
beginFill(0);
moveTo(227, 368);
lineTo(227, 381);
lineTo(217, 375);
lineTo(227, 368);
endFill();
}
with (nextF) {
lineStyle(0, 13421772);
beginFill(0);
moveTo(279, 368);
lineTo(279, 381);
lineTo(289, 375);
lineTo(279, 368);
endFill();
createEmptyMovieClip("cross", 1);
square(cross, "fs", 275, 364, 18, 20, iconColorF, iconColorS);
cross.createTextField("crosstext", myDepth, 279, 367, 10, 20);
cross.crosstext.text = "+";
cross.crosstext.textColor = 16711680 /* 0xFF0000 */;
}
square(onion, "fs", 309, 368, 9, 9, 16777215, 6710886);
square(onion, "fs", 312, 371, 9, 9, 16777215, 6710886);
myLabelStyle = new TextFormat();
with (myLabelStyle) {
font = "Verdana";
color = 3355443 /* 0x333333 */;
size = 9;
}
lTextSize = 40;
var labelText = new Array();
labelText[0] = new Array("drawing_txt", "DRAWING", 7, 15, 60);
labelText[1] = new Array("animating_txt", "ANIMATING", 20, 367, 70);
labelText[2] = new Array("pencilW_txt", "width", 35, 45, lTextSize);
labelText[3] = new Array("lineW_txt", "width", 35, 91, lTextSize);
labelText[4] = new Array("new_txt", "New", 123, 367, 40);
labelText[5] = new Array("clear_txt", "Clear", 175, 367, 40);
labelText[6] = new Array("frame_txt", "Frame", 236, 348, 40);
labelText[7] = new Array("frameRateL_txt", "FPS", 376, 348, 40);
labelText[8] = new Array("play_txt", "Play", 417, 367, 40);
labelText[9] = new Array("loop_txt", "Loop", 453, 367, 40);
labelText[10] = new Array("reverse_txt", "Back", 491, 367, 50);
var i = 0;
while (i < labelText.length) {
this.createTextField(labelText[i][0], myDepth, labelText[i][2], labelText[i][3], labelText[i][4], lTextSize);
with (this[labelText[i][0]]) {
selectable = false;
text = labelText[i][1];
setTextFormat(myLabelStyle);
}
myDepth++;
i++;
}
myTextStyle = new TextFormat();
with (myTextStyle) {
font = "Verdana";
color = 3355443 /* 0x333333 */;
size = 10;
bold = true;
align = "center";
}
var aTextWidth = 40;
var aTextHeight = 20;
var activeText = new Array();
activeText[0] = new Array("pencilWidth_txt", 0, 37, 59, 25, 16);
activeText[1] = new Array("lineWidth_txt", 0, 37, 105, 25, 16);
activeText[2] = new Array("rValue_txt", 0, 28, 220, 33, aTextHeight);
activeText[3] = new Array("gValue_txt", 204, 28, 245, 33, aTextHeight);
activeText[4] = new Array("bValue_txt", 255, 28, 270, 33, aTextHeight);
activeText[5] = new Array("frameRate_txt", 12, 366, 364, aTextWidth, aTextHeight);
activeText[6] = new Array("currentFrame_txt", 1, 233, 364, aTextWidth, aTextHeight);
var i = 0;
while (i < activeText.length) {
this.createTextField(activeText[i][0], myDepth, activeText[i][2], activeText[i][3], activeText[i][4], activeText[i][5]);
with (this[activeText[i][0]]) {
type = "input";
border = true;
borderColor = 6710886 /* 0x666666 */;
align = "center";
background = true;
text = activeText[i][1];
setTextFormat(myTextStyle);
setNewTextFormat(myTextStyle);
}
myDepth++;
i++;
}
with (currentFrame_txt) {
type = "dynamic";
selectable = false;
text = 1;
}
rValue_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 0)) {
this.text = 0;
} else if (this.text > 255) {
this.text = 255;
}
adjustColor();
};
gValue_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 0)) {
this.text = 0;
} else if (this.text > 255) {
this.text = 255;
}
adjustColor();
};
bValue_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 0)) {
this.text = 0;
} else if (this.text > 255) {
this.text = 255;
}
adjustColor();
};
pencilWidth_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 0)) {
this.text = 0;
} else if (this.text > 15) {
this.text = 15;
}
_root.pencilThick = Number(this.text);
};
lineWidth_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 0)) {
this.text = 0;
} else if (this.text > 15) {
this.text = 15;
}
_root.lineThick = Number(this.text);
};
frameRate_txt.onChanged = function () {
if ((this.text == "") || (Number(this.text) < 1)) {
this.text = 1;
} else if (this.text > 30) {
this.text = 30;
}
_root.speed = Number(this.text);
};
pencilTool.onRelease = function () {
tool = "pencil";
selectedTool._x = 0;
selectedTool._y = 0;
};
lineTool.onRelease = function () {
tool = "line";
fill = false;
selectedTool._x = 0;
selectedTool._y = 45;
};
cHollow.onRelease = function () {
tool = "circle";
fill = false;
selectedTool._x = 0;
selectedTool._y = 90;
};
cFill.onRelease = function () {
tool = "circle";
fill = true;
selectedTool._x = 34;
selectedTool._y = 90;
};
sHollow.onRelease = function () {
tool = "box";
fill = false;
selectedTool._x = 0;
selectedTool._y = 130;
};
sFill.onRelease = function () {
tool = "box";
fill = true;
selectedTool._x = 34;
selectedTool._y = 130;
};
newproject.onRelease = function () {
newProjectFunction();
};
remove.onRelease = function () {
removeAnimFunction();
};
previousF.onRelease = function () {
previousDrawing();
};
nextF.onRelease = function () {
nextDrawing();
};
onion.onRelease = function () {
onionSkin();
};
playback.onRelease = function () {
showtime();
};
looping.onRelease = function () {
loopFunction();
};
reversePlay.onRelease = function () {
reverseFunction();
};
Frame 3
var tool = "pencil";
var lineThick = 0;
var pencilThick = 0;
var r;
var g;
var b;
var fColor;
var sColor;
var d = 0;
var totalDrawings = 0;
var cell;
var onionMode = false;
var speed = 12;
var playing = false;
var loop = false;
var reverseMode = false;
adjustColor();
drawingtools();
stop();