Frame 1
function drawRectangle(target_mc, xpos, ypos, boxWidth, fillColor) {
startx = xpos - (boxWidth / 2);
starty = ypos - (boxWidth / 2);
endx = xpos + (boxWidth / 2);
endy = ypos + (boxWidth / 2);
if (endx > WIDTH) {
endx = WIDTH;
}
if (endy > HEIGHT) {
endy = HEIGHT;
}
if (startx < 0) {
startx = 0;
}
if (starty < 0) {
starty = 0;
}
with (target_mc) {
beginFill(fillColor);
moveTo(startx, starty);
lineTo(endx, starty);
lineTo(endx, endy);
lineTo(startx, endy);
lineTo(startx, starty);
endFill();
}
}
var bitmap_bg = flash.display.BitmapData.loadBitmap("pic.jpg");
_root.createEmptyMovieClip("background_image", _root.getNextHighestDepth());
background_image.attachBitmap(bitmap_bg, _root.getNextHighestDepth());
HEIGHT = background_image._height;
WIDTH = background_image._width;
boxSize = 50;
setInterval(this, "tile", 10);
tile = function () {
if (boxSize > 2) {
boxSize = boxSize - 0.05;
}
i = 0;
while (i < 1) {
xpos = Math.round(Math.random() * WIDTH);
ypos = Math.round(Math.random() * HEIGHT);
color = bitmap_bg.getPixel(xpos, ypos);
drawRectangle(rectangle_mc, xpos, ypos, boxSize, color);
i++;
}
};
this.createEmptyMovieClip("rectangle_mc", _root.getNextHighestDepth());
background_image._visible = false;