On the ball instance: onClipEvent (enterFrame) { bounceBall (); } On the main timeline: function bounceBall () { if(ball1._y < 0){ ball1._y += 5; } if(ball1.y > 399){ ball1._y -= 5; } }