Flash Movie Controls – Play/Pause Button

I’m not very experienced in Flash. I can do basic movies with tweens, some playback buttons and maybe one or two animations, but that’s pretty much it. For a recent project however, I had to do a pause button.

Now this might seem like an easy task, but it isnt. A pause button must both pause and play the video. I looked around the web for some easy solutions, but couldn’t come up with anything useful (although I’m sure there are guides for it out there, I just didn’t look hard enough..). This is what I came up with:

How to create a Play/Pause button in Flash

  1. Create a movieclip called “playpause”. Put this movieclip anywhere in your main movie.
  2. Create a button in this movieclips first frame, call this button “pause”.
  3. Now go to frame two, create a keyframe and another button, call this one “play”.
  4. Create another layer, call this layer “script”. Put the marker in the first frame and open Frame Actions. Type in “stop();”. Create another keyframe, and do the same thing again.
  5. The buttons need some actionscripting too to be able to work. They need to both make the other button display and to play and pause our movie, which is the main target. I found a way to do this really easily. Click the button “pause”, and open Button Actions. Then type in:

on (release) {
gotoAndStop(2);
_parent.stop();
}

The first line displays the play button, the other one pauses the main movie. Select the other button, “play”, and type in:

on (release) {
gotoAndStop(1);
_parent.play();
}

Save the document, press Command+Enter (PC: CTRL+Enter) and make sure it works.

I hope you found the guide useful! Please leave a comment below and let me know what you thought.

74 thoughts on “Flash Movie Controls – Play/Pause Button

  1. I hope you get this – I just want to say that I spent, literally, an hour looking through help files, and Flash user group sites and google searches and ask.com searches and the Adobe site and… well, just everywhere I could possibly think of to find this solution to this simple, simple problem. (make pause/play buttons for Flash main timeline) I found NOTHING until I came across your posting here, which is just exactly what I needed. So simple, and so, so hard to find. Thank you!

  2. Fantastic. Works exactly how I wanted it to! The only issue I had was that I was trying to put the actions on the frame, not on the buttons. That obviously didn't work. So, if anyone out there is as new as me, just be sure that your action panel says "Actions – Button" at the top, not "Actions-Frame".

    1. So simple, and it works perfectly. Thanks for your great contribution to those of us in need of short & to the point tutorials.

  3. Isaac, thank you for the code.

    Do you think there is a way to make the button go back to a play button once the movie has finished?

  4. I worry a little about the having the code spread around in different places in the movie clip, but it sure is simple. Thanks for sharing it!

  5. Excellent, thank you. I too flailed around looking for the answer in help sections & online without success.
    One thing — if someone, like me, in their flailing inserted Pause and Play Behaviors, you must delete them or they will interfere with the button controls, and you will be driven bat-crap crazy when the buttons won't work.

  6. Very useful, but yet so simple. 🙂 I fully understand the script as well, so that I can try to create own timeline controlling stuff myself! 😀 Great job!

  7. works at stopping my timeline but not the movie clips and flv file i have in my timeframe…any ideas?

  8. Unfortunately it can only pause the main timeline, I'm afraid.

    Hope you get it working! And if you do, let me know and I'll put up a note about the solution. 🙂

  9. Hi, this seemed like the perfect solution till I realised it wasn't pauseing other movie clips within the main timeline. As another new user to Flash I've got a feeling this requires a bit more complex bit of code, does anyone know how it's done?

  10. when i finished making the movie clip and tried to test it , it works fine for pausing the film but i cant make it play again??
    please reply asap

  11. Buttons change but they don't affect the movie. I've put my movie in a movieclip in a new layer under PlayPause layer. I've out loadMovie(movie,0); on movieclips frame. What have I done wrong? Help!

  12. Sorry, just re-read comments and realised that the movie must be placed in the main timeline not in a movieclip – works like a dream now! Many thanks!

  13. Very helpful! I'm trying to make flash slideshows to display my work in my portfolio and this was just life-saving!!!

    THANK YOU! ^.^

  14. thanks for this! really wanted this.. most of the stuff online tell you how to make two separate buttons and put the Stop and Play actions on it. lame.

    thanks a million!

  15. wonderful tutorial!!! Thankz for posting it.
    I experimented and found that if the movieclip is placed inside another movieclip, then also the command works for that movieclip alone and not for the whole flash file. This is really excellent.
    Thanks thanks a lot!!!

  16. I am having a hard time following this..
    I made a slide show and have the forward and back buttons working..
    I want it to play automatically slowly and put a play pause button on as well.. Anyone know what i should do?

  17. This information was increadibly helpful. If you have Adobe Flash CS3, there is a control pannel called "Components". In this section, there are all the controls for making a movie pause/play. You only need to drag them to your movie. If you do not have this version the code above works great! Thanks again.

  18. thanx mate…can we have a slider along side the button to control the movie clip….?? like it moves along with the movie and we can drag to any point and it starts the movie from that point??? if u can do it…it would be amazing

  19. Excellent tutorial, took a bit to do as I was using Actionscript 3.0! You can't seem to use the Actions -Buttons command in AS3 only AS2, once the publish settings were changed no probs!

    Many thanks

  20. WOW!!! THANK YOU! Words alone are not enough. Just as the first comment said, I spent so long looking for this exact solutuion and it was nowhere. Only thing was just as someone pointed out I had to set the export settings to ActionScript 2.0 or it did not work.

  21. Hi,

    I've created a flash slideshow which is going over 16000 frames, so i've split the movie into two.
    I'm loading the second movie at the end of main movie using "loadMovieNum".

    I have the placed the play/pause button in the main movie. It works fine until the second movie loads. This is used to work in older version of Flash(Flash 8). I'm using CS4 now.

    Do you have any workaround for this?

Leave a Reply