You have to give it a different name too. And each letter should have it’s own time reference. Check this out:
cellSize=5;
radius=20;
damp=.9;
numLetter=0;
letterSpacing=30;
letterI=new Array(
[0,1,0,0],
[0,1,0,0],
[0,1,0,0],
[0,1,0,0]);
letterL=new Array(
[1,0,0,0],
[1,0,0,0],
[1,0,0,0],
[1,1,1,1]);
letterY=new Array(
[1,0,0,1],
[1,1,1,1],
[0,0,0,1],
[0,0,0,1]);
letterA=new Array(
[1,1,1,1],
[1,0,0,1],
[1,1,1,1],
[1,0,0,1]);
letterS=new Array(
[1,1,1,1],
[0,1,0,0],
[0,0,1,0],
[1,1,1,1]);
function containerRollOVer(){
delete this.onRollOver;
for (var clip in this) this[clip].explode();
}
function displayCell(letter){
var num,i,j,mc;
clip=this.createEmptyMovieClip("container"+numLetter,numLetter++);
clip._x=numLetter*letterSpacing;
for (j=0;j < letter.length;j++){
for (i=0;i < letter[0].length;i++){
if (letter[j]*==1){
mc=clip.attachMovie("cell","cell"+num,num);
mc.i=i;
mc.j=j;
mc._x=i*cellSize;
mc._y=j*cellSize;
// mc.onRollOver=explode;
num++;
}
}
}
this.clip.onRollOver=containerRollOver;
}
MovieClip.prototype.explode=function(){
this.start=getTimer();
this.vx=(Math.random()-.5)*radius;
this.vy=(Math.random()-.5)*radius;
this.onEnterFrame=function(){
this._x+=this.vx;
this._y+=this.vy;
this.vx*=damp;
this.vy*=damp;
if (getTimer()-this.start > 2000 ) this.onEnterFrame=spinningAround;
// if (this.vx < .1 && this.vy < .1) delete this.onEnterFrame;
}
}
function spinningAround(){
var diffx=this._x-this.i*cellSize;
var diffy=this._y-this.j*cellSize;
this._x-=diffx/7;
this._y-=diffy/7;
if (Math.abs(diffx)+Math.abs(diffy) < .1){
this._x=this.i*cellSize;
this._y=this.j*cellSize;
this._parent.onRollOver=containerRollOver;
}
}
displayCell(letterI);
displayCell(letterL);
displayCell(letterY);
displayCell(letterA);
displayCell(letterS);
A bit long…
pom :cowboy: