Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

as 2 to as 3

New Here ,
May 03, 2014 May 03, 2014

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

TOPICS
ActionScript
275
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 03, 2014 May 03, 2014

instance name of x0 is in_place

                          v0 is in_velocity

                          a is acceleration

                          t is time

                          s is placement

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2014 May 04, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2014 May 04, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2014 May 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2014 May 04, 2014

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 ??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2014 May 04, 2014
LATEST

gambar.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines