5.28.05

Here's the chunk of code that governs the above:

import mx.transitions.Tween;
import mx.transitions.easing.*;

var speedDivider = 10;
var boxDivider = 5;

var mainColor = "0xFFFFFF";
var spacer = Stage.width *.01;
var boxSize = Stage.width/boxDivider -1;


var goalx0 = - boxSize;
var goalx1 = Stage.width + boxSize;
var goaly0 = - boxSize;
var goaly1 = Stage.height + boxSize;

function drawBox(boxName, boxSize, boxAlpha, Xplace, Yplace, thisAxis, thisDirection) {
    createEmptyMovieClip(boxName, _root.getNextHighestDepth());
    _root[boxName].beginFill(_root.mainColor, boxAlpha);
    _root[boxName].lineTo(boxSize, 0);
    _root[boxName].lineTo(boxSize, boxSize);
    _root[boxName].lineTo(0, boxSize);
    _root[boxName].lineTo(0, 0);
    _root[boxName].endFill();
    _root[boxName]._x = Xplace;
    _root[boxName]._y = Yplace;
    _root[boxName].thisDirection = thisDirection;

    _root[boxName + "tween"] = new Tween(_root[boxName], ["_" +thisAxis] , None.easeInOut, 0 , _root["goal"+thisAxis+thisDirection], boxAlpha/_root.speedDivider, true);
    _root[boxName + "tween"].onMotionFinished = function() {
        if (_root[boxName].thisDirection == 0) {
            _root[boxName].thisDirection = 1;
        } else {
            _root[boxName].thisDirection = 0;
        }
        _root[boxName + "tween"] = new Tween(_root[boxName], ["_" +thisAxis] , None.easeInOut, _root[boxName]["_" + thisAxis], _root["goal"+thisAxis+_root[boxName].thisDirection], boxAlpha/_root.speedDivider, true);
        _root[boxName + "tween"].onMotionFinished = function() {
            _root[boxName + "tween"].yoyo()
        }
    };
}

for (i=1; i< 8; i++) {
    for (j=1; j< 8; j++) {
        var alphaMultiplier = Math.ceil(Math.random()*10);
        if (((i%2)+(j%2))%2 == 0) {
            thisAxis = "x";
        } else {
            thisAxis = "y";
        }
        if ((j%2) ==0) {
            thisDirection = 1;
        } else {
            thisDirection = 0;
        }
        drawBox(["box"+i+"_"+j], boxSize, alphaMultiplier * 5, (i-1)*(spacer+boxSize), (j-1)*(spacer+boxSize), thisAxis, thisDirection);
    }
}



stop();