The following code generates a 12 8 grid of our node clips whenever
the user clicks on the Stage and makes each copy go to and stop at a
random frame number:
this.onMouseDown = function( ) {
var depth = 0;
for (var i = 0; i < 12; i++) {
for (var j = 0; j < 8; j++) {
var me = "n" + i + j;
this.attachMovie("node", me, depth++);
this[me]._x = 50 * i;
this[me]._y = 50 * j;
this[me].gotoAndStop(random(100) + 1);
}
}
};
To make our pattern appear more complex, we can nest further copies
of node into the pattern. Each copy of node
contains the following code:
if (Math.ceil(Math.random( ) < 0.80)) {
this.attachMovie("node", "n", 0);
this["n"]._x = 50*i;
this["n"]._y = 50*j;
this["n"]._xscale = n._yscale = _parent._xscale / 1.5;
this["n"].gotoAndStop(Math.ceil((Math.random( )*10)));
}