Color Grid
Generating a grid of randomly colored sqaures with Swishscript. This really ends up being a tutorial about positioning and size control with swishscript.
The Script
onLoad()
{
nLevel=0;x=0;y=0;nsize=20;nColor=0xFFFFFF;
}
onFrame(1)
{
_root.createEmptyMovieClip("holder",nLevel);
holder.moveTo(x,y);
holder.lineStyle(0,nColor,100);
holder.beginFill(Math.round(Math.random()*0xFFFFFF), 100);
holder.lineTo(x+nsize,y);
holder.lineTo(x+nsize,y+nsize);
holder.lineTo(x,y+nsize);
holder.lineTo(x,y);
endfill()
}
onFrame(2)
{
nLevel++;
x+=nsize;
if(x>300-nsize){x=0;y+=nsize;}
if(y>300-nsize){y=0;nLevel=0}
gotoandPlay(1);
}