# Can't get this animation to work

**URL:** <https://forum.kirupa.com/t/cant-get-this-animation-to-work/181772>\
**Category:** Uncategorized\
**Created:** [March 12, 2006, 11:24pm UTC](https://forum.kirupa.com/t/cant-get-this-animation-to-work/181772 "2006-03-12T23:24:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash1810](https://avatars.discourse-cdn.com/v4/letter/f/258eb7/32.png) [@flash1810](https://forum.kirupa.com/u/flash1810)\
**Post date:** [March 12, 2006, 11:24pm UTC](https://forum.kirupa.com/t/cant-get-this-animation-to-work/181772/1 "2006-03-12T23:24:43Z")

</div>

Hi there…

I am trying to build avery simple animation…

Basically i have 3 balls; i want them to come to the screen (left to right) with a little “bouncy” effect and then stop.

I managed to create the animation and the bouncy effect for one ball…  
The problem i am having is replicating the animation for each of the balls.  
I’d like them to appear one at the time.  
So basically:  
ball\_0 bounce-stop then  
ball\_1 bounce-stop then  
ball\_2 bounce-stop.

i include the code…if anybody could help it’ d be great…

Cheers…  
D

Code:

var spring:Number = 0.2;  
var friction:Number = 0.75;

init();

var id:Number = setInterval(springIn,30);

function init():Void {  
//initialize array of targets  
targets = new Array(170,110,50);  
thumbCount = 3;  
for (var i:Number = 0;i\<thumbCount;i++){  
ball = attachMovie(“ball”,“ball” +i,i);  
ball.\_x = -80;  
ball.\_y = 100;  
ball.vx = 0;  
ball.vy = 0;  
}  
}

function springIn() {  
for (var i:Number = 0;i\<thumbCount;i++) {  
ball = this[“ball” +i];  
trace(ball);  
ball.ax = (targets\* - ball.\_x) \* spring;  
ball.vx += ball.ax;  
ball.vx _= friction;  
ball.\_x += ball.vx;  
if (Math.abs(ball.\_x - targets_) \< 1) {  
clearInterval(id);  
}  
}  
}
