Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Play & Stop A Playing Motion Tween with Actionscript 3

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
13,048
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 29, 2009

Order full 4 hours and 24 minute course on CD and DVD http://www.alonzohosford.com/index.php?page=order_cd_paypal&page_action=o...

Flash buttons from the common library are used to show how to start and stop playing animations on the Scene 1 timeline. Introduces writing Actionscript 3 for buttons and how a template is used to write the code for each button.

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (alonzohosford)

  • hey i have a question i just want to repeat the motion tween that i did and i want to continuesly playing this motiontween. how to add this in action script?

  • No Actionscript is required. Flash automatically repeats a timeline unless you explicitly add Actionscript to stop it. Perhaps you are still using the IDE Control Play which is a testing play that does stop a tween and designed for checking a timeline without running actionscript or publishing the movie. Once you publish the movie or use Control Test Movie which publishes the movie you see the tweens as they would be played in the final movie.

  • I wish I had time for that. It would require a whole series.

    I recommend you go to my web site Adobe book store and look at the book ActionScript 3.0 Game Programming University. U will learn a lot about Actionscript u will need for gaming as well as gaming

    alonzohosford.

    com

    ?

    page

    =

    adobe_store

  • I may have accidentally deleted this comment from meggles48

    Do you think you could do a tutorial on building a game using ActionScript? I have a game that I would like to put together, but I'm not very good with the ActionScript. It involves a mix of soccer, football, and Frisbee. Could I send you a layout of the game?

  • You lost me with the cutting and pasting of the template which I don't have access to. How are we suppose to access that file? I went to your website and cannot see where to access them other than buy your book on Amazon.

  • I have no books on Amazon and there are no templates.

    Some videos have starter exercises and I mention them at start of video if they exist.

    You can go to my web site alonzohosford dot com and you will find support files to exercises.

see all

All Comments (28)

Sign In or Sign Up now to post a comment!
  • Great to hear. Only comment I was going to have is to be sure the button code is on the frame where the buttons are located. But it seems u figured it out.

  • Oh, I'm an idiot, taken me so long to realise my stupid mistakes.

    This is perfect thankyou.

  • @swedenips thankyou so very much for your help by the way, I ran out of characters.

  • @lonhosford ok, could you help with my code?

    sun_btn.addEventListener(Mouse­Event.CLICK, sun_btn_onMouseClick);

    function sun_btn_onMouseClick(e:MouseEv­ent):void

    { play(); stop(); gotoAndPlay(sun_btn); where sun_btn = 1 gotoAndStop(sun_btn); where sun_btn = 35

    }

    moon_btn.addEventListener(Mous­eEvent.CLICK, moon_btn_onMouseClick);

    function moon_btn_onMouseClick(e:MouseE­vent):void

    { play(); stop(); gotoAndPlay(moon_btn);  where moon_btn = 35 gotoAndStop(moon_btn); where moon_btn = 70

    }

  • First animation is on frame 1 to where it ends. One more frame has the moon as a button and a stop action. Next frame but I recommend a second layer has the reverse animation with again one additional frame that would have the sun as the button and a stop action. The button moon would say gotoAndPlay (frame number were sun going down animation starts). The button sun would gotoAndPlay (frame where the sun going up starts).

  • @lonhosford what I'm doing is creating a day and night scene, so when you click the sun, it will set and the moon will rise. I want it to stop there once that's played, and then when you click the moon it will reverse.

    I think I have to change something?

  • To payback in reverse, you need to use the menus to duplicated the tween and then the menus to reverse the tween. Then you can simply use the actionscript seen in this video.

  • I downloaded the file for this, but I want to know how to use the second half of it which lists 'gotoandstop' as I need my animation to play to a certain frame and then play back again in reverse when clicked.

    I can't find a video that teaches how to use the 'gotoandstop/play' parts?

  • You will need to create movie clips for each tween. Then one will loop and the other will have a stop action. Actionscript applies to a single timeline and the stage is a single timeline and each movieclip is a single timeline.

  • Does anyone know how to stop a specific motion tween while another keeps looping?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more