# Array AS in Pom's footer

**URL:** https://forum.kirupa.com/t/array-as-in-poms-footer/23323
**Category:** flash
**Created:** [June 16, 2003, 2:25pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323 "2003-06-16T14:25:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![no\_bone\_movie](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@no\_bone\_movie](https://forum.kirupa.com/u/no_bone_movie)
#### Post date: [June 16, 2003, 2:25pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/1 "2003-06-16T14:25:56Z")

</div>

I really like the text effect Pom used in the footer contest, and would like to use the same grid-type method of creating mc letters but with a different effect. i understand how to change the parameters and shapes of the letters, but can’t seem to figure out which piece of code is purely for the explosion effect. :sigh: basically, i want the letters but with the ‘Repel’ effect from

[http://downloads.junioronline.us](http://downloads.junioronline.us)

here is Pom’s AS:

[AS]  
cellSize=3;  
radius=10;  
damp=.85;  
dampR=.8;  
numLetter=0;  
letterSpacing=40;  
shift = .5;

letterP=new Array(  
[1,1,1,1,1,0],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1],  
[1,1,1,1,1,0],  
[1,1,0,0,0,0],  
[1,1,0,0,0,0]);  
letterO=new Array(  
[0,1,1,1,1,0],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1],  
[0,1,1,1,1,0]);  
letterM=new Array(  
[1,1,0,0,0,1],  
[1,1,1,0,1,1],  
[1,1,0,1,0,1],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1],  
[1,1,0,0,0,1]);

function containerRollOVer(){  
delete this.onRollOver;  
for (var clip in this) this[clip].explode();  
}

function displayCell(letter){  
var num=1,i,j,mc;  
clip=this.createEmptyMovieClip(“container”+numLetter,numLetter++);  
clip.\_x=30+numLetter_letterSpacing;  
clip.\_y=20;  
clip.createEmptyMovieClip(“cell”,0).\_visible = 0;  
clip.cell.lineStyle(cellSize,0xcccccc,100);  
clip.cell.lineTo(.15,.45);  
for (j=0;j\<letter.length;j++){  
for (i=0;i\<letter[0].length;i++){  
if (letter[j]_==1){  
mc=clip.cell.duplicateMovieClip(“cell”+num,num);  
mc.i=i;  
mc.j=j;  
mc.\_x=i\*(cellSize+shift);  
mc.\_y=j\*(cellSize+shift);  
num++;  
}  
}  
}  
clip.cell.removeMovieClip();  
this.clip.onRollOver=containerRollOver;  
}

MovieClip.prototype.explode=function(){  
this.vx=(Math.random()-.5)_2_radius;  
this.vy=(Math.random()-.5)_2_radius;  
this.onEnterFrame=function(){  
this.resizeCell();  
this.\_x+=this.vx;  
this.\_y+=this.vy;  
this.vx\*=damp;  
this.vy\*=damp;  
if (Math.abs(this.vx)+Math.abs(this.vy) \< .08)  
this.onEnterFrame=spinningAround;  
}  
}

function spinningAround(){  
var diffx=this.\_x-this.i\*(cellSize+shift);  
var diffy=this.\_y-this.j\*(cellSize+shift);  
this.resizeCell();  
this.vx-=diffx/7;  
this.vy-=diffy/7;  
this.vx\*=dampR;  
this.vy\*=dampR;  
this.\_x+=this.vx;  
this.\_y+=this.vy;  
if (Math.abs(this.vx)+Math.abs(this.vy) \< .01){  
this.\_x=this.i\*(cellSize+shift);  
this.\_y=this.j\*(cellSize+shift);  
delete this.onEnterFrame;  
this.\_parent.onRollOver=containerRollOver;  
}  
}

MovieClip.prototype.resizeCell=function(){  
var diffx=this.\_x-this.i_cellSize;  
var diffy=this.\_y-this.j_cellSize;  
var dist=diffx_diffx+diffy_diffy;  
this.\_xscale=this.\_yscale=this.\_alpha=(10000-dist)/100;  
// you can try that instead:  
// this.\_xscale=this.\_yscale=this.\_alpha=(1000-dist)/10;  
}

displayCell(letterP);  
displayCell(letterO);  
displayCell(letterM);  
[/AS]

and here is the .fla using the repel effect using pre-made mc:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 2:34pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/2 "2003-06-16T14:34:38Z")

</div>

MovieClip.prototype.explode

is purely for the explosion…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 2:49pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/3 "2003-06-16T14:49:16Z")

</div>

it works but when i run the mouse over the letters, the whole letters move rather than become divided as in the junioronline fla. any ideas how i can free up the small square sections in each letter?

thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 3:04pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/4 "2003-06-16T15:04:01Z")

</div>

whats the code in your movie?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 3:20pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/5 "2003-06-16T15:20:21Z")

</div>

I haven’t got any real code yet! just thought i’d add this if i could get it to work the way i want it to. just tried replacing the explode script with the repel script. the repel script affect any mc on the stage, but it’s treating the small squares as the whole letter the create rather than individual squares. hope this makes sense.  
here’s what i’ve been messing with:

[AS]  
cellSize=2;  
radius=10;  
damp=.8;  
dampR=.8;  
numLetter=0;  
letterSpacing=30;  
shift = .5;

letterL=new Array(  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,0,0,0,0],  
[1,1,1,1,1,1,1,1]);  
letterO=new Array(  
[0,1,1,1,1,1,1,0],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[0,1,1,1,1,1,1,0]);  
letterA=new Array(  
[0,1,1,1,1,1,1,0],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,1,1,1,1,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1]);  
letterD=new Array(  
[1,1,1,1,1,1,0,0],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,1,1,1,1,0,0]);  
letterI=new Array(  
[0,0,1,1,1,1,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,0,1,1,0,0,0],  
[0,0,1,1,1,1,0,0]);  
letterN=new Array(  
[1,1,0,0,0,0,1,1],  
[1,1,1,0,0,0,1,1],  
[1,1,1,1,0,0,1,1],  
[1,1,0,1,1,0,1,1],  
[1,1,0,0,1,1,1,1],  
[1,1,0,0,0,1,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1]);  
letterG=new Array(  
[0,1,1,1,1,1,1,0],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,0,0],  
[1,1,0,0,1,1,1,1],  
[1,1,0,0,0,0,1,1],  
[1,1,0,0,0,0,1,1],  
[0,1,1,1,1,1,1,0]);  
function containerRollOVer(){  
delete this.onRollOver;  
for (var clip in this) this[clip].explode();  
}

function displayCell(letter){  
var num=1,i,j,mc;  
clip=this.createEmptyMovieClip(“container”+numLetter,numLetter++);  
clip.\_x=30+numLetter_letterSpacing;  
clip.\_y=20;  
clip.createEmptyMovieClip(“cell”,0).\_visible = 0;  
clip.cell.lineStyle(cellSize,0xcccccc,100);  
clip.cell.lineTo(.15,.45);  
for (j=0;j\<letter.length;j++){  
for (i=0;i\<letter[0].length;i++){  
if (letter[j]_==1){  
mc=clip.cell.duplicateMovieClip(“cell”+num,num);  
mc.i=i;  
mc.j=j;  
mc.\_x=i\*(cellSize+shift);  
mc.\_y=j\*(cellSize+shift);  
num++;  
}  
}  
}  
clip.cell.removeMovieClip();  
this.clip.onRollOver=containerRollOver;  
}

MovieClip.prototype.onEnterFrame = function()  
{  
if (this.\_name != “”)  
{  
if (!this.defaultX) this.defaultX = this.\_x;  
if (!this.defaultY) this.defaultY = this.\_y;  
magnet = 500;

```
	this.X0 = this._x;	
	this.y0 = this._y;
	this.X1 = _root._xmouse;
	this.Y1 = _root._ymouse;
		
	this.distanceX = this.X1-this.X0
	this.distanceY = this.Y1-this.Y0
	this.distance = Math.sqrt((this.distanceX * this.distanceX) + (this.distanceY * this.distanceY))
	
	this.powerX = this._x - (this.distanceX / this.distance) * magnet / this.distance;
	this.powerY = this._y - (this.distanceY / this.distance) * magnet / this.distance;
	this.forceX = (this.forceX + (this.defaultX - this.X0) / 2) / 1.66
	this.forceY = (this.forceY + (this.defaultY - this.Y0) / 2) / 1.66

	this._x = this.powerX + this.forceX;
	this._y = this.powerY + this.forceY;
}

```

}

function spinningAround(){  
var diffx=this.\_x-this.i\*(cellSize+shift);  
var diffy=this.\_y-this.j\*(cellSize+shift);  
this.resizeCell();  
this.vx-=diffx/7;  
this.vy-=diffy/7;  
this.vx\*=dampR;  
this.vy\*=dampR;  
this.\_x+=this.vx;  
this.\_y+=this.vy;  
if (Math.abs(this.vx)+Math.abs(this.vy) \< .01){  
this.\_x=this.i\*(cellSize+shift);  
this.\_y=this.j\*(cellSize+shift);  
delete this.onEnterFrame;  
this.\_parent.onRollOver=containerRollOver;  
}  
}

MovieClip.prototype.resizeCell=function(){  
var diffx=this.\_x-this.i_cellSize;  
var diffy=this.\_y-this.j_cellSize;  
var dist=diffx_diffx+diffy_diffy;  
this.\_xscale=this.\_yscale=this.\_alpha=(10000-dist)/100;  
// you can try that instead:  
// this.\_xscale=this.\_yscale=this.\_alpha=(1000-dist)/10;  
}

displayCell(letterL);  
displayCell(letterO);  
displayCell(letterA);  
displayCell(letterD);  
displayCell(letterI);  
displayCell(letterN);  
displayCell(letterG);  
[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 3:54pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/6 "2003-06-16T15:54:09Z")

</div>

It’s going to kill your CPU, I’m afraid… And what do you mean by this?

> \*Originally posted by no bone movie \*  
> **any ideas how i can free up the small square sections in each letter?**

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2003, 4:16pm UTC](https://forum.kirupa.com/t/array-as-in-poms-footer/23323/7 "2003-06-16T16:16:41Z")

</div>

> \*Originally posted by Ilyas \*  
> \*\*It’s going to kill your CPU, I’m afraid… And what do you mean by this? \*\*

i had a feeling it was getting a bit much :sigh:

i meant allow the small squares (which make up the letters) to move freely rather than be rigid, the way they do in the junioronline fla.

thanks anyway 🙂
