Play/Pause toggle buttons!

Classes are over, but I got asked by quite a few people how to make a button that would toggle between  play and pause. Since I just had to make one, I figured I’d post up how I did it here.

1) After you’ve created the play and pause buttons for your flv playback (see previous post), create a new movie clip (Insert –> New Symbol). I named mine pp_btn.

2) Inside this clip, put one button on each frame. If your movie autostarts, put the pause button on frame 1 and the play button on frame 2; if it doesn’t, put the play button on frame 1.

3) Create a new layer called “actions.” Insert a keyframe on both frames 1 and 2, and put a stop action on each.

4) Select the first button. Inside your on(release) action for that button, add the line: gotoAndPlay (2). Now, select the second button. Inside your on(release) action for that button, add the line: gotoAndPlay (1).

Example script from a pause button placed on frame one:

on (release) {
_root.myVideo.pause();
gotoAndPlay (2);
}

5) Go into your library and find the new movie clip. Drag it to the stage and test it. Now, your button should toggle!

Advertisements

About Marguerite Halley

Marguerite has been working in digital content and design for universities and nonprofits through her entire career. As a digital content strategist at Washington University in St. Louis and a usability/content strategy consultant for nonprofits, she’s a champion for the user and an advocate for clear, engaging content on the web.

Posted on 05/19/2011, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: