Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
instance name of x0 is in_place
v0 is in_velocity
a is acceleration
t is time
s is placement
Copy link to clipboard
Copied
It looks as if the only change you need to make is to change " _x " to " x ".
Copy link to clipboard
Copied
but,,I think that's not enough sir,,there are must be to add,,,for examp : addevenlistener and the class
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
thank u sir,,this is the picture of my simulatation,,if we input number in (v0),(a) and (t), and then press the play button,,automatically the value of ( x ) will appear and the car will move to right. on the above is the action script in AS 2,,can u change into AS 3 sir ??
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now