Solved

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

Posted on 2009-07-15
6
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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 select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

617 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