Skip to main content
Rinzhu
Participant
May 4, 2014
Question

as 2 to as 3

  • May 4, 2014
  • 2 replies
  • 314 views

hello,,I have a trouble,, I want to make an interactive media simulation,,in as 2 I can, but to change the script in as 3 I don't know,,could you help me please to change this script into as3

Frame 1

var x0:Number;

var v0:Number;

var a:Number;

var t: Number;

var s:Number;

var t_travel:Number;

var t_base:Number;

function inisialitation(){

                car._x = 0;

                x0=car._x;

                s=0;

                v0=0;

                vt=v0;

                a=0;

                t=0;

                t_travel=0;

                delta=0.1;

}

inisialitation();

stop();

 

Frame 2

if(t<=t_travel){

                car._x = x0+v0*t+(1/2)*a*t*t;

                vt=v0+a*t;

                s= car._x-x0;

}else{

                s= v0*t_travel+(1/2)*a*t_travel*t_travel;

                vt = v0+a*t_travel;

                stop();

}

 

Frame 3

t=t+delta;

gotoAndPlay(2);

thanks for your attention

This topic has been closed for replies.

2 replies

Ned Murphy
Legend
May 4, 2014

It looks as if the only change you need to make is to change " _x " to " x ".

Rinzhu
RinzhuAuthor
Participant
May 5, 2014

but,,I think that's not enough sir,,there are must be to add,,,for examp : addevenlistener and the class

Ned Murphy
Legend
May 5, 2014

Nothing of the code that you showed has anything to do with event listeners.  If there is more involved then what you have shown, you are the only one who knows of it.  If there happen to be buttons or other objects you see that need to be interactive then you need to identify them and what their purpose is.

Rinzhu
RinzhuAuthor
Participant
May 4, 2014

instance name of x0 is in_place

                          v0 is in_velocity

                          a is acceleration

                          t is time

                          s is placement