# Trails

**URL:** https://forum.kirupa.com/t/trails/220313
**Category:** flash
**Created:** [March 25, 2007, 1:49am UTC](https://forum.kirupa.com/t/trails/220313 "2007-03-25T01:49:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kingofnukes](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kingofnukes](https://forum.kirupa.com/u/kingofnukes)
#### Post date: [March 25, 2007, 1:49am UTC](https://forum.kirupa.com/t/trails/220313/1 "2007-03-25T01:49:18Z")

</div>

Hi, I’m trying to make an actionScripted animation that resembels a data grid.  
Right now I’ve already created the grid and what I call “Grid Monkeys” which are little circles that travel the grid. Now I want them to leave a trail as they move. How can I integrate that into my code.

Here is my creation code:  
[AS]  
function createMonkey(M) {  
var Max = M;  
for (var i = 0; i\<M; i++) {  
Total++;  
linePick = randomRange(0, yMax);  
// 0-500  
var m = \_root.attachMovie(“probe”, “probe”+Total, Total, {\_x:xMax, \_y:linePick});  
m.onEnterFrame = Move;  
}  
}  
randomRange = function (min, max) {  
return Math.floor(Math.random()\*(max-min+1))+min;  
};  
function Move() {  
if (this.Decide\<=0) {  
this.dirPick = randomRange(1, 8);  
this.Decide = randomRange(1, 50);  
} else {  
this.Decide -= 1;  
}  
if (this.dirPick == 1) {  
this.Dir = “Up”;  
this.xSpeed = 0;  
this.ySpeed = -2;  
} else if (this.dirPick == 2) {  
this.Dir = “Down”;  
this.xSpeed = 0;  
this.ySpeed = 2;  
} else if (this.dirPick == randomRange(3, 10)) {  
this.Dir = “Left”;  
this.xSpeed = 2;  
this.ySpeed = 0;  
}  
this.\_x -= this.xSpeed;  
this.\_y += this.ySpeed;  
//createTrail  
[//this.attachMovie](https://this.attachMovie)(“trail”, “Trail”+i, this.getNextHighestDepth(), {\_x:this.\_x+3, \_y:this.\_y+4});  
}  
[/AS]
