Este es el codigo
Código :
function drawQuad(clip, color) {
path = _root.page4[clip];
path.clear();
path.lineStyle(0, 0xFFFFFF, 30);
path.beginFill(color, 30);
path.moveTo(x[0], y[0]);
path.lineTo(x[1], y[1]);
path.lineTo(x[2], y[2]);
path.lineTo(x[3], y[3]);
path.endFill(x[0], y[0]);
}
// Define screen extents for later use...
Stage.scaleMode = "exactFit";
middleX = Stage.width/2;
middleY = Stage.height/2;
Stage.scaleMode = "noScale";
/*
create clip...
*/
_root.createEmptyMovieClip("page4", 100);
page4._x = middleX;
page4._y = middleY;
for (i=0; i<16; i++) {
page4.createEmptyMovieClip("quad"+i, i);
page4["quad"+i]._rotation = i*(360/16);
}
/*
Initialize points...
*/
width = 100;
height = 100;
x = new Array();
y = new Array();
sX = new Array();
sY = new Array();
x[0] = 0;
y[0] = 0;
x[1] = 0;
y[1] = -height;
x[2] = -width;
y[2] = -height;
x[3] = -width;
y[3] = 0;
for (i=1; i<4; i++) {
sX[i] = Math.random()*2+2;
sY[i] = Math.random()*2+2;
}
page4.onEnterFrame = function() {
for (i=1; i<4; i++) {
x[i] += sX[i];
y[i] += sY[i];
if (Math.abs(x[i])>width) {
sX[i] = -sX[i];
}
if (Math.abs(y[i])>height) {
sY[i] = -sY[i];
}
}
for (i=0; i<16; i++) {
drawQuad("quad"+i, 0x0);
}
}; 