Solved

How can I toggle between play and pause using actionscript in a flash file?

Posted on 2009-07-15
6
205 Views
Last Modified: 2013-11-11
I have a .fla file that I want to play/pause.  I have inserted the actionsript below onto the button layer.  The button is only visible on the very first frame.  The movie plays once the button is clicked, but I am unable to pause/play the .fla file once the button has been clicked the first time.
import flash.events.EventDispatcher;
import flash.display.MovieClip;
this.stop();
function startMovie(event:MouseEvent):void {
	this.gotoAndPlay(2);
}
mybutton.addEventListener(MouseEvent.CLICK,startMovie);

Open in new window

0
Comment
Question by:tprofits
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 24868443
Hi there.
i'm a bit confused.
if the button is clicked it goes to play frame 2 where the button doesn't exist anymore, so how would they click it to stop it?
0
 

Author Comment

by:tprofits
ID: 24869886
The user is currently unable to stop the flash video.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 24876318
okay i'm sorry i don't understand what it is you're trying to achieve then.
you say you want a toggle button to start/stop the timeline. but your button is on frame 1. once the movie plays the button is no longer accessible so how do you intend for them to stop it?
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:tprofits
ID: 24877944
I think the best way would be to add a play/pause button on frames 2 through 1050.
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 24885430
you only need one button. then they can stop or start it whenever they want.
you can create a 2 frame movieclip to toggle the labels for start / stop.
i think you need to first decide what you want to do before finding out how to do it.
0
 

Author Closing Comment

by:tprofits
ID: 31603989
Agreed.  I reassessed my direction and ended up using a one button on frame 1.  Another set of buttons on the remaining frames.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Migrate From Flash Media Server 4.5 To IIS Smooth Streaming or VLC 6 1,139
Stock Videos 17 332
Flash Player White Screen Facebook 5 762
black magic design 1 128
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question