# Thread: Anyone know ActionScript 2?

1. ## Anyone know ActionScript 2?

Hey, I need some help with ActionScript. I'm supposed to write a script to track a movement of an object, such as a ball, using action script 2.0 (yes, my school's really outdated). Can anyone help me with this?

I'm bad at explaining this but say an object falls, every ~5 pixels, it will create that object stationary in that location. So that way you can see the path the object takes.

2. Originally Posted by | ∞ |
Hey, I need some help with ActionScript. I'm supposed to write a script to track a movement of an object, such as a ball, using action script 2.0 (yes, my school's really outdated). Can anyone help me with this?

I'm bad at explaining this but say an object falls, every ~5 pixels, it will create that object stationary in that location. So that way you can see the path the object takes.
Does it have to be ActionScript 2? Why not ActionScript 3?

3. ^

4. Path prediction?

Write a formula for the motion of the object with respect to time, plug in time, and check if the ball or whatever collides with the boundary each frame. The moment it does, t-1 is the time to predict the path.

function psuedoformula(time)
{
var new_y = ball._y + time*5;

if (new_y > 300) //if the ball is past 300 (the boundary)
return -1;
else
return new_y;
}

var time = 0;

while (psuedoformula(time) != -1)
{
time++;
}

var ball2 = attachMovieClip(ball_symbol);
ball2._alpha = 50;
ball2._y = psuedoFormula(time-1);
Off the top of my head.

5. ## The Following User Says Thank You to arunforce For This Useful Post:

| ∞ | (05-16-2014)

6. Originally Posted by AQWThunder
Does it have to be ActionScript 2? Why not ActionScript 3?
My school requires that for some reason.

Originally Posted by arunforce
Path prediction?

Write a formula for the motion of the object with respect to time, plug in time, and check if the ball or whatever collides with the boundary each frame. The moment it does, t-1 is the time to predict the path.

Off the top of my head.
Awesome thanks!