Frame 1
function project(vtx) {
var _local1 = theta / 57.296;
var _local5 = (vtx[0] * Math.cos(_local1)) + (vtx[2] * Math.sin(_local1));
var _local3 = vtx[1];
var _local2 = (vtx[2] * Math.cos(_local1)) - (vtx[0] * Math.sin(_local1));
_local3 = (_local3 * Math.cos(_local1)) - (_local2 * Math.sin(_local1));
_local2 = (_local2 * Math.cos(_local1)) + (vtx[1] * Math.sin(_local1));
_local2 = _local2 + 60;
var _local6 = 4000 / _local2;
_local5 = (Stage.width / 2) + (_local5 * _local6);
_local3 = (Stage.height / 2) + (_local3 * _local6);
return([_local5, _local3, _local2]);
}
function cross(a, b) {
return([(a[1] * b[2]) - (a[2] * b[1]), (a[0] * b[2]) - (a[2] * b[0]), (a[0] * b[1]) - (a[1] * b[0])]);
}
function dot(a, b) {
return(((a[0] * b[0]) + (a[1] * b[1])) + (a[2] * b[2]));
}
function facing(v1, v2, v3) {
var _local3 = [v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]];
var _local2 = [v2[0] - v3[0], v2[1] - v3[1], v2[2] - v3[2]];
var _local6 = cross(_local3, _local2);
var _local7 = [0, 0, 1];
return(false);
}
function getdepth(pface) {
var _local4 = pface[0][2];
var _local5 = pface[0][2];
var _local3 = 0;
for (var _local2 in pface) {
if (pface[_local2][2] > _local4) {
_local4 = pface[_local2][2];
}
if (pface[_local2][2] < _local5) {
_local5 = pface[_local2][2];
}
_local3 = _local3 + pface[_local2][2];
}
return({min:_local5, mid:_local3, max:_local4});
}
function zsort(a, b) {
if (a.z.mid > b.z.mid) {
return(-1);
}
if (a.z.mid < b.z.mid) {
return(1);
}
return(0);
}
function drawobj(obj, clip) {
var _local8 = obj.vertices;
var _local5 = obj.faces;
var _local4 = [];
for (var _local14 in _local5) {
var _local2 = [];
for (var _local9 in _local5[_local14]) {
if (_local14 < 24) {
theta = theta / 2;
}
_local2.push(project(_local8[_local5[_local14][_local9]]));
if (_local14 < 24) {
theta = theta * 2;
}
}
var _local7 = getdepth(_local2);
_local4.push({vertices:_local2, z:_local7, faceno:_local14 % 2, pyr:_local14 >= 24});
}
_local4.sort(zsort);
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].vertices;
if (_local4[_local2].z.min < 0) {
} else {
var _local1 = clip;
_local1 = clip.createEmptyMovieClip("c" + random(999999), clip.getNextHighestDepth());
if (_local4[_local2].pyr) {
_local1.beginFill((_local4[_local2].faceno ? 8355839 : 16777215), 100);
} else {
_local1.beginFill((_local4[_local2].faceno ? 16744319 : 16777215), 100);
}
_local1.lineStyle(0, 0, 0);
_local1.moveTo(_local3[0][0], _local3[0][1]);
_local1.lineTo(_local3[1][0], _local3[1][1]);
_local1.lineTo(_local3[2][0], _local3[2][1]);
_local1.endFill();
_local1._alpha = 70;
}
_local2++;
}
}
function dump(o) {
for (k in o) {
}
}
function ddd() {
var _local1 = cubeframes.createEmptyMovieClip("t" + theta, cubeframes.getNextHighestDepth());
drawobj(myobj, cubeframes["t" + theta]);
cubeframes["t" + theta]._visible = false;
}
stop();
var myvertices = [[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1], [0, 0, -1], [0, 0, 1], [-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [-3, 0, 0], [-1.5, 0, 3], [1.5, 0, 3], [3, 0, 0], [1.5, 0, -3], [-1.5, 0, -3], [0, -4, 0], [0, 4, 0]];
var myfaces = [[0, 1, 8], [1, 2, 8], [2, 3, 8], [3, 0, 8], [1, 5, 11], [5, 6, 11], [6, 2, 11], [2, 1, 11], [4, 0, 10], [0, 3, 10], [3, 7, 10], [7, 4, 10], [4, 5, 9], [5, 6, 9], [6, 7, 9], [7, 4, 9], [4, 5, 12], [5, 1, 12], [1, 0, 12], [0, 4, 12], [3, 2, 13], [2, 6, 13], [6, 7, 13], [7, 3, 13], [20, 14, 15], [20, 15, 16], [20, 16, 17], [20, 17, 18], [20, 18, 19], [20, 19, 14], [21, 18, 17], [21, 17, 16], [21, 16, 15], [21, 15, 14], [21, 14, 19], [21, 19, 18]];
var myobj = {vertices:myvertices, faces:myfaces};
theta = 0;
_quality = "MEDIUM";
slices = [];
_root.createEmptyMovieClip("cubeframes", getNextHighestDepth());
theta = 0;
_quality = "LOW";
theta = 0;
while (theta < 360) {
ddd();
theta = theta + 30;
}
Key.addListener(_root);
scrollertext = "YES I FINALLY DID IT!!! AND THE DEPTH SORTING ALSO WORKS, ALMOST :) SORRY FOR THIS DUMB SCROLLER ~CODA ";
var my_fmt = new TextFormat();
my_fmt.font = "scrollfont";
var c = 0;
while (c < scrollertext.length) {
var cmc = _root.createEmptyMovieClip("cmc" + c, _root.getNextHighestDepth());
var ctf = cmc.createTextField("scrolltxt" + c, cmc.getNextHighestDepth(), 1, 1, 32, 32);
cmc["scrolltxt" + c].embedFonts = true;
my_fmt.color = 16755404 /* 0xFFAACC */;
cmc["scrolltxt" + c].text = scrollertext.charAt(c);
cmc["scrolltxt" + c].setTextFormat(my_fmt);
cmc["scrolltxt" + c].selectable = false;
my_fmt.color = 8323135 /* 0x7F003F */;
var ctf = cmc.createTextField("scrolltxt", cmc.getNextHighestDepth(), 0, 0, 32, 32);
cmc.scrolltxt.embedFonts = true;
cmc.scrolltxt.text = scrollertext.charAt(c);
cmc.scrolltxt.setTextFormat(my_fmt);
cmc.scrolltxt.selectable = false;
cmc.p = -1.570795;
cmc.p_i = (6.283185 * c) / scrollertext.length;
cmc.x = 250 * Math.cos(cmc.p_i + cmc.p);
cmc.z = Math.sin(cmc.p_i + cmc.p);
cmc._x = 160 + cmc.x;
cmc._y = 192;
cmc._alpha = 0;
cmc._xscale = (cmc._yscale = 100 - cmc.z);
cmc.swapDepths(int((-cmc.z) * 100));
c++;
}
cubeframes.swapDepths(int(_root.getNextHighestDepth() / 2));
u = 0;
_root.onEnterFrame = function () {
var _local6 = "t" + theta;
theta = theta - -5;
if (theta >= 360) {
theta = 0;
}
var _local5 = "t" + theta;
var _local4 = cubeframes;
if (!_local4[_local5]) {
ddd();
}
_local4[_local6]._visible = false;
_local4[_local5]._visible = true;
var _local3 = 0;
while (_local3 < scrollertext.length) {
var _local2 = _root["cmc" + _local3];
_local2.p = _local2.p - 0.01;
_local2.x = 250 * Math.cos(_local2.p_i + _local2.p);
_local2.z = 20 * Math.sin(_local2.p_i + _local2.p);
_local2._x = (Stage.width / 2) + _local2.x;
_local2._y = 192 + _local2.z;
_local2._xscale = (_local2._yscale = 100 - _local2.z);
if (u <= 100) {
_local2._alpha = u;
}
_local2.swapDepths(int((-_local2.z) * 100));
_local3++;
}
u = u + 5;
};