Frame 1
function drawLine(x1, y1, x2, y2) {
x1 = x1 - lines._x;
x2 = x2 - lines._x;
y1 = y1 - lines._y;
y2 = y2 - lines._y;
lines.lineStyle(7, 2631720, 100, false, "none", "none", "bevel", 1);
lines.moveTo(x1, y1);
lines.lineTo(x2, y2);
}
function startOver() {
var _local2;
var _local3;
_local2 = 2;
while (_local2 < 1000) {
_local3 = _root["rect" + _local2];
_local3.removeMovieClip();
_local2++;
}
lines.clear();
rect1 = attachMovie("splitRect", "rect1", 1, obj);
rect1._x = 20;
rect1._y = 20;
}
var levl = 2;
var obj = new Object();
obj.wt = 800;
obj.ht = 600;
var rect1 = attachMovie("splitRect", "rect1", 1, obj);
rect1._x = 20;
rect1._y = 20;
this.createEmptyMovieClip("lines", 9999);
lines._x = 20;
lines._y = 20;
restart._visible = false;
stop();
Symbol 1 MovieClip [splitRect] Frame 1
function onColor(obj, menuItem) {
removeLine();
var _local1 = dfltColor;
if (menuItem.caption == "RED") {
_local1 = 11940640 /* 0xB63320 */;
} else if (menuItem.caption == "BLUE") {
_local1 = 2110344 /* 0x203388 */;
} else if (menuItem.caption == "YELLOW") {
_local1 = 13944644 /* 0xD4C744 */;
} else if (menuItem.caption == "WHITE") {
_local1 = 14606048 /* 0xDEDEE0 */;
} else if (menuItem.caption == "BLACK") {
_local1 = 1250067 /* 0x131313 */;
}
var _local3 = new flash.geom.ColorTransform();
_local3.rgb = _local1;
var _local4 = new flash.geom.Transform(r);
_local4.colorTransform = _local3;
dfltColor = _local1;
}
function removeLine() {
active = false;
hline._visible = false;
vline._visible = false;
last3 = new Array();
}
var xp = 0;
var yp = 0;
var last3 = new Array();
var active = false;
if (wt == undefined) {
wt = 800;
}
if (ht == undefined) {
ht = 600;
}
if (dfltColor == undefined) {
dfltColor = 14606048 /* 0xDEDEE0 */;
}
this.createEmptyMovieClip("r", 10);
r.lineStyle(0, 15658734, 1, false, "none", "none", "bevel", 1);
r.beginFill(dfltColor, 100);
r.moveTo(xp, yp);
r.lineTo(xp + wt, yp + 0);
r.lineTo(xp + wt, yp + ht);
r.lineTo(xp + 0, yp + ht);
r.lineTo(xp + 0, yp + 0);
r.endFill();
this.createEmptyMovieClip("hline", 100);
hline.beginFill(1118481, 90);
hline.lineStyle(5, 1118481, 100, false, "none", "none", "bevel", 1);
hline.moveTo(0, 0);
hline.lineTo(wt, 0);
hline.endFill();
this.createEmptyMovieClip("vline", 101);
vline.beginFill(1118481, 90);
vline.lineStyle(5, 1118481, 100, false, "none", "none", "bevel", 1);
vline.moveTo(0, 0);
vline.lineTo(0, ht);
vline.endFill();
hline._visible = false;
vline._visible = false;
var my_cm = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("RED", onColor));
my_cm.customItems.push(new ContextMenuItem("BLUE", onColor));
my_cm.customItems.push(new ContextMenuItem("WHITE", onColor));
my_cm.customItems.push(new ContextMenuItem("YELLOW", onColor));
my_cm.customItems.push(new ContextMenuItem("BLACK", onColor));
this.menu = my_cm;
this.onRollOver = function () {
this.active = true;
};
this.onRollOut = function () {
this.removeLine();
};
this.onMouseMove = function () {
if (!active) {
return(undefined);
}
hline._visible = false;
vline._visible = false;
var _local2 = new Object();
_local2.xpos = this._xmouse;
_local2.ypos = this._ymouse;
last3.push(_local2);
if (last3.length > 3) {
last3.shift();
var _local4 = Math.abs(last3[0].xpos - _local2.xpos);
var _local3 = Math.abs(last3[0].ypos - _local2.ypos);
if (_local4 >= _local3) {
vline._visible = true;
vline._x = this._xmouse;
} else {
hline._visible = true;
hline._y = this._ymouse;
}
}
};
this.onPress = function () {
var _local3 = new Object();
var _local5 = new Object();
_local3.xp = this._x;
_local3.yp = this._y;
_local3.wt = this.wt;
_local3.ht = this.ht;
_local3.dfltColor = this.dfltColor;
_local5.xp = this._x;
_local5.yp = this._y;
_local5.wt = this.wt;
_local5.ht = this.ht;
_local5.dfltColor = this.dfltColor;
var _local4 = new Object();
if (hline._visible) {
_local3.ht = hline._y;
_local5.ht = _local5.ht - _local3.ht;
_local5.yp = _local3.yp + _local3.ht;
_local4.x = hline._x;
_local4.y = hline._y;
this.localToGlobal(_local4);
_root.drawLine(_local4.x, _local4.y, _local4.x + this.wt, _local4.y);
} else if (vline._visible) {
_local3.wt = vline._x;
_local5.wt = _local5.wt - _local3.wt;
_local5.xp = _local3.xp + _local3.wt;
_local4.x = vline._x;
_local4.y = vline._y;
this.localToGlobal(_local4);
_root.drawLine(_local4.x, _local4.y, _local4.x, _local4.y + this.ht);
} else {
return(undefined);
}
removeLine();
var _local6 = "rect" + (_root.levl++);
var _local8 = _root.attachMovie("splitRect", _local6, _root.levl, _local3);
_local8._x = _local3.xp;
_local8._y = _local3.yp;
_local6 = "rect" + (_root.levl++);
var _local7 = _root.attachMovie("splitRect", _local6, _root.levl, _local5);
_local7._x = _local5.xp;
_local7._y = _local5.yp;
this.removeMovieClip();
};
stop();
Symbol 15 Button
on (press) {
_root.startOver();
}
on (rollOver) {
restart._visible = true;
}
on (rollOut) {
restart._visible = false;
}