Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

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

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
tprofits
Asked:
tprofits
  • 3
  • 3
1 Solution
 
blue-genieCommented:
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
 
tprofitsAuthor Commented:
The user is currently unable to stop the flash video.
0
 
blue-genieCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
tprofitsAuthor Commented:
I think the best way would be to add a play/pause button on frames 2 through 1050.
0
 
blue-genieCommented:
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
 
tprofitsAuthor Commented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now