Solved

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

Posted on 2009-07-15
6
204 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to put actionscript code for a button? 6 118
Action Script commands 4 305
Adobe Flash Player - PPAPI plugin 6 535
How to convert image files to a movie file 6 108
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now