Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Pause/play Button Controlling .swf On Level 2



I have a movie where I have loaded an .swf using the loadMovieNum command into level 2. On the main timeline I have a pause/play button that I would like to control the .swf I loaded into level 2. What would the code be on this pause/play button to control the .swf on level 2?



FlashKit > Flash Help > Flash ActionScript
Posted on: 11-17-2004, 10:43 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Play And Pause While Controlling The Sound
I would like to know how to stop and play the sound on the Play and pause buttons. Pleas let me know the actionscript for the same. I am working on Macromedia Flash 8.0 (Actionscript 2.0)

Controlling External Set Of Movies With Play Pause And Skip Buttons
hi all,

Been looking for some tutorials on how to get this done but cannot find any. After I build this out I want to post up in the tutorials section.

Ok I was wondering if someone could help me on this small problem I am having. I have a total of 4 flash movies. The first movie will house all my navigation as shown below:

[Movie 2] [Movie 3] [Movie 4] [Pause] [Play ] [Skip to Next Movie]

The simple part of course are the first 3 buttons basically just loadmovie statements.

Now the next 3 buttons are the part I cannot quite figure out. The logic from what I have been reading is basically is the create a variable on the mainstage that updates itself each time a new movie is playing. This way you can tell the movie "pause" or "play" because it has a name.

Any actionscripters want to lend a hand on this? I have included the files all setup just need to few lines of scripting. I want to also post this as a tutorial since I cannot locate any tutorials with this sort of logic.

thanks in advance!

Creating Play/Pause Toggle Buttons Controlling Slide Presentation Timeline
Need guidance in creating Action Script to create a single button on a Flash Slide Presentation screen that toggles between Play and Pause icons and functions controlling timeline playback, just as happens on the Flash Media Controller panel when playing back a video clip. I assume this would involve a Component button, but not sure how to assign icons and functions to the toggle states.

How To Play Sound Automatically And Trigger The Play And Pause On The Same Button?
hey guys,

is anyone know how to set a looping sound to play automatically but with a pause button to trigger its action? if i want the sound play back again could i just click on the same "pause" button to let it play again? pls help me to make it works thanks!!!

Play & Pause Button
Hi, Flashizens

I have made a movei in whichi i used play and pause button. Both the buttons are different! Actually, I want to use a single button with mouse over. I mean, when i play movie, the pause button should be active and when I pause movie, play button should be active. And one more thing, I need mouseOver effect for the button!!

HOW TO DO?

Pause And Play Button
Hi,
I wonder how I do a pause button.
I guess pause is the same action as stop but I want the button to change.
I have done a button for pause. When pressed, I want it to change to a play button. So when they press the button it starts to play again.
How do I do that?

Thanks for fast answer
/Anna

Play/pause Button
Hey everybody!

I am trying to make a simple pause/play button.

Thanx

Pause/Play Button
I've searched everywhere and I can't find a solution to my problem, so if you do find a relevant post, I'm really sorry.

So here's my problem: I want to get rid of the quicktime plugin for my audio file on my website and integrate it into my flash menu. All I want is a pause/play button that changes, just like the quicktime plugin.

I have found tutorials that teach me how to pause/stop. I have learned to make two buttons within a movie clip.

I have also found tutorials that teach me how to pause a sound file using a variable and having it pick back up at same spot where it left off.

However, I cannot combine these two in anyway, because the pause/stop tutorial uses the stop() function and that seems to be stopping the entire movie, including the sound.

This is what I have so far, inside the movie clip, for the buttons:
-----------------------------------------
Frame 1
myMusic = new Sound(myMusicMc);
myMusic.attachSound("myMusic01");
myMusicVolume=100;
myMusic.setVolume(myMusicVolume);
myMusic.start(0,999);
playing=true;
--------------------------------------
Frame 2
stop();
-----------------------------------
Frame 2 Button
on (release) {
myMusicPosition=_root.myMusic.position/1000;
myMusic.stop("myMusic01");
gotoAndPlay(3);
}
-----------------------------------
Frame 3
stop();
---------------------------------
Frame 3 Button
on (release) {
myMusic.start(myMusicPosition,999);
gotoandplay(2);
}
-----------------------------------

Is there ANYWAY I can make the movie stop without having the sound stop?? Please let me know! Thanks!

Pause/Play Button Help.
Good morning fellow flashers. I need some help. I'm working on a video player. Now I have two buttons that I would like to combine, play and pause. Much like I tunes. Any way i want to script the button so when I hit the play button the movie startes and then the button turns to the pause function. So if any of yall know of some ways to go about this help me out please, thanks

Pause/play Button
Can anyone take a look at the attached and tell me what i am doing wrong? I have a simple animation that needs to be paused and played by button and i can't seem to get it worked.
Thank you very much!

Pause/play Button
Hi there,

I have been trying to upload a fla i have downloaded from this site, but for some reason it's not attaching. Anyway, does anyone have a simple fla, which would help me? I need a button which when pressed pauses a animation in the main timeline and then when pressed again it plays again?

Anyone??!!

Play/pause Button
Ok, I know that there are probably 3 million of these threads, but I have questions a plenty. You see, I am trying to make a music quiz and I need a play and a pause button. I have no clue where to start.

Also, in flash MX, as far as I know, you can't type your own actionscript. So if I find help, I can't copy and paste the actionscript right into my flash. I could use some help here. Thanks!

Pause And Play Button
Code:
if (_play==true) {
_root.mapper.stop();
_play = false;
this.gotoAndStop(2)
} else {
_root.mapper.play();
_play = true
this.gotoAndStop(1);
}
}
first press of button should stop the movie 2nd press should play it.
it stops it but i cant start it again.
how do i fix this???

Play And Pause In One Button.
Hi all
I am looking for a way to incorporate both play and pause functions into one button… to control a sound file. Does anyone have any simple code to do this? On the first press the button should play the sound file and on the second press it should pause, and so on. Any help would be much appreciated.

Thanks Hugo.

Play/Pause Button?
Hi,

I'm trying to create a play/pause button. In it's 'up' state, the button displays a play icon (triangle) and once it's clicked I want the icon to change to a pause icon (two vertical lines). Creating the button using a normal button symbol won't work because once the user has clicked the button the button should stay changed to the pause button until it's clicked again. (Using a button symbol would mean that on mouseDown, the pause button would be displayed but would then revert back to the play button on mouseUp).

Does anyone know how to get the button to change and stay changed once it's clicked?

Cheers in advance.

Ste.

Play/Pause Button
I have created my buttons, but cant seem to get them to work for my flash "presentation". I have about 19 movie clips, each on their own layers and keyframe. The buttons need to be able to control each of those movie clips, so as they play on their own layer one ofter the other, that the buttons can pause it at any moment, then play on from where it was paused. Can someone please help me with the actionscript that should go with the buttons, I have tried, but no success. This is like a "powerpoint presentation but only done in flash". Also where must the buttons be placed? On the main timeline? because that is how it is at the moment? so must the buttons have some actionscript guiding it to control the frames inside the movie clip? how do i do that?

Ask if anything might be unclear.
Thank you for any help!

Play/pause Button
I want to use pause and play buttons.
The pause button is working well but I have a problem with the play button.
Clicking the play button the music starts from the beginning and not from the point it stopped.
Any useful link?

Play/Pause Button
Hi all,

I'm trying to create a button that will play and pause the timeline. I have already created one button that has Action Script to play and one button that has Action Script to stop. My new button needs to be a single button that when clicked it plays the timeline and switches to a pause button. When the button is pressed again it stops the timeline and switches back to the play button.

Any help is greatly appreciated.

Working with Flash MX and 8.

--Steve

Pause And Play Button
can any one tell me the code to make a button pause and the code for a button to play on that frame so it doesnt start the movie over again

edit: oh and i use 2004 flash mx edition

Play/pause Button
I know there are about a million tutorials on play/pause buttons out there but none of them really gave me what I need. I have multiple SWFs, each with a song embedded in them. They are loaded into level99 when a button is clicked. I need the code for a simple button that on click will pause the sound in level99 and then on another click will resume the sound again.

Thanks,
Mike W.

Play/Pause Button
Hi does anyone have a script to play/pause an animation I have created? Thank you

Play/pause Button Help
Hi, newbie here.

Question about play/pause buttons; I've got a pause button which refuses to work. I've tried


Code:
on (release) {
stop();
}
and


Code:
on (press) {
stop();
}
but they don't work. The play button works fine though. The file has music, so maybe that's a contributing factor? Because I've tested the buttons without music and they work fine.

Another question: I want to know how to place a "Play" button before an animation.

Thanks in advance!

Pause Play Button
i need to make a pause and play button

how can it get it to pause MC too????

tell target? wuah?

Play/pause Button Help
I have a slideshow that plays when a button is clicked, and pauses when clicked agian. Now I want the button to change the graphic when clicked from a play picture to a pause picture and back again. I have found stuff for as2 but not really for as3 (at least nothing I could understand), so can someone give me some pointers? My as3 code for the current play button looks like this:

play_btn.addEventListener(MouseEvent.CLICK, onPlay);
function onPlay(evt:MouseEvent):void {
if (playOnClick){
timer.start();
playOnClick = false;
} else{
timer.reset();
playOnClick = true;
}

Play/pause Button Help
Hi, newbie here.

Question about play/pause buttons; I've got a pause button which refuses to work. I've tried


Code:
on (release) {
stop();
}
and


Code:
on (press) {
stop();
}
but they don't work. The play button works fine though. The file has music, so maybe that's a contributing factor? Because I've tested the buttons without music and they work fine.

Another question: I want to know how to place a "Play" button before an animation.

Thanks in advance!

Flv Play/pause Button
Hi, I have the following code to stream an flv with a button that will pause and play the flv but it's not working.

settings: flash 9 / actionscript 2.0

code:

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
vidTV.attachVideo(stream_ns);
stream_ns.play("video.flv");
//

myPlayPauseButton.onRelease = function (){
if(vidTV.paused){
vidTV.play();
}else{
vidTV.pause();
}
}


what seems to be wrong?

Please help....thanks.

Johan,

Play/pause Button
Could someone help me in creating a play/pause button, which starts in the play state, and goes to the pause state when the movie (or whatever it's controlling) is playing then back to the play state when paused .. like the button on the Quicktime player..

thanks

Play And Pause Button Swapping
This should be an easy one for you flash gurus. I'd like my play button to become my pause button while the movie is playing.


Thanks,

AntiX

Simple Pause/play Button
just two simple buttons...one for pause and one for play.

My clip automatically begins playing and I want to add the option of pausing and then resuming with the play button. So far I've only been able to get the music to stop (but not resume) with the AS on release stopAllsounds but the movie continues to play even if I add the AS stop in addition to the stopALLsounds.

Then there is the problem of resuming where the viewer left off with play button.

I've searched the boards and have not come across a simple solution.

Please, if someone could just spell it out for me as I am fairly new to flash 5.

Simple Pause Play Button
Would like to know how to make a simple Pause/Play button.

I already know how to make buttons but I need the actionscript code to make a button pause the whole movie, then when the user clicks on the button again the movie will replay where it left off.

Can anyone here help me out?

Alternating Pause/Play Button
I'm trying to add a PAUSE button to allow the viewer to stop the movie from playing, while paused the button changes to PLAY for the user to restart the movie. This seemed like an easy task by showing and hiding MCs containing the buttons. The (stop) and (play) buttons don't seem to work from within my MCs. Does anyone have code similar to this? Thanks for any help.

XML MP3 Player Play And Pause Button
Hello,

After reading MANY message board postings, I finally found an XML MP3 player that met my needs ... almost. The player uses XML to call the tracks one by one and display the title (AWESOME!), but it seems to have a lot more features (within the code) that I'm not sure what I could do with (see the loaded drop-down list and the option to have stations, etc.). If anyone can offer me a clue, I'd be greatly appreciative! It's a nice player!

In any case, one of my concerns is that the player does not offer a pause feature. I've read the tutorial about pausing looping MP3 files at http://www.sonify.org, but I'm not sure how to apply the code to this particular player? Is there an easy way to do this?

Also, how could I alter the code to make the player start when the page loads? At the moment, you have to push the play button to get the songs to begin. I'd like it if the songs would already play when the page is loaded.

Any other advice is much appreciative! I'll attach the .zip file to this posting. Thanks!

Play/Pause Rollover Button
I'm looking to create a button that when clicked will pause the flash movie and when clicked again will continue playing. If possible, I would also like to be able to swap the images when clicked. So, for example, when the movie is playing there would be a button that says "pause". When the button is clicked, the movie would pause and the button would switch to one that says "resume play". Then when that button is clicked, the movie would play and the button would switch back to "pause".

Is there any way to do this? I've done it a lot in Director, but can't seem to get it to work in Flash. Please help!!!

Play Pause Button Not Working Exactly Like Should...
Hey gurus, I need some help!

I have buttons controling the timeline of a movie clip. I followed the directions in SAMS Teach yourself... but it's not exactly user friendly.

I have a rewind button and a play/pause button. My issue is the play button starts as a pause. when you click pause it shows play, then you need to click play to get the movie started. Once you get it started it works perfect. How can I get it to start with one click?

OK, code:

Movie clip (group3_choral8) holds the movie and the rewind button, then I've pulled in a second movie clip (play_pause) with the toggle button in it. The play_pause clip contains 2 frames.

Frame 1:

Pause button which contains:
on (press) {
_parent.stop();
gotoAndStop(2);
}

Frame 2:

Play button which contains
on (press) {
_parent.play();
gotoAndStop(1);
}

And on frame one there is a stop button.

I have tried swapping buttons. In my first movie clip I moved the play_pause movie clip to frame 2 and put a play button in frame 1 - this made it not work at all. I tried putting a new layer in and hiding the pause button with a play button, that didn't work.

Any suggestions?

Thanks!!

Play And Pause Button Trouble
I am doing an interative cd-rom using flash mx2004 pro.

I have added stop and play buttons to the main time line and these work fine - however, I have many embedded movie clips in the main time line and when I click the stop button I want it to pause whichever embedded movie file happens to be playing at that particular time, as well as the main time line.

Also, I am using the code "stop" and "play" - is there a code for "pause" that would toggle between pausing and playing - hence only requiring one button?

any help would be appreciated.

cheers guys (and gals)

Play/Pause Button Functionality
I created a presentation with multiple movie clips scattered throughout along with a streaming voiceover tracks. Is there an easier way to stop/play the movie through my pause/play button rather than targeting every movie clip in my presentation? Something like the control of global playback no matter what movie clip/clips are playing at the moment the button is pressed?

Thanks.

Play And Pause Stopwatch Without Button
Hi. Has anyone ever done this? I've got a stopwatch and I can make it start with a an enterFrame, but I can't figure out how to stop it using a frame action rather than a button. I really want it to pause() when a specific hitTest happens or a frame reached or something. Any ideas?

The pause button had this on it:

on (press) {
//if (_parent.ampunchedin) {
if (state == "on") {
_parent.clockPause();
gotoAndStop("pause");
} else {
_parent.clockResume();
gotoAndStop("on");
}
//}
}

I've got it starting with a clip event:

onClipEvent (enterFrame) {
clockStart()
}

So I assumed the hitTest in the _root would be something like:

onClipEvent (enterFrame) {
if (hitTest(_root.rider.riderHit)) {
_root.rider.gotoAndPlay("leftWipeOut");
_root.rider.stopwatch.clockPause();
}
}

But that doesn't work.

I've also tried to do an onEnterFrame with a clip off the stage, but it's like I'm not getting the path right or something.

thanks for looking

jorge

[F8] Movie Play/pause Button
I've searched everywhere for just a simple movie play/pause button. Everyone just laughed! Can someone please just give me the basic play button script, or a tutorial on buttons?

Help With Simple Play/pause Button
I'm trying to make a single button both stop and play the movie. (I'm using setInterval to pause the movie at various points.) I'm trying to learn actionscript, so please excuse any terrible errors. (simple example file attached)

First frame of movie:

function pause(){
play();
clearInterval(timer);
}
playing=true;

if (playing=true){
playing!=false;
}
else if (playing!=true){
playing=false;
}

On the button:

on (release, keyPress "<Space>"){
clearInterval(timer);
if (playing=true){
stop();
playing!=true;
}
else if (playing=false){
play();
}
}

Making A Pause/Play Button
what is the script to make such a button?

Thanks

Pause/Play Toggle Button?
I have an AIF file I created in Garage Band. This AIF has been placed into a movie clip called "mymusic" that has been placed on a layer in my movie with an instance name of "mymusic."

I have created play button and pause buttons that utilize the following scripts to stop the sound and the movie and then resume the sound and movie from the point where it was stopped:


Play Button:

on (press) {
play();
tellTarget ("mymusic") {
play () ;
}
}


Stop Button:

on (press) {
stop();
tellTarget ("mymusic") {
stop () ;
}
}


This works perfectly. Now the client wants me to combine the play and pause button and create a single toggle button that achieves what the above two described buttons did.

Any thoughts? Please help!!!

[F8] Play / Pause Toggle Button
Hello everyone, I have a project that requires a single button to play and pause the .swf. I am trying to make the button say play when the movie is stopped, when clicked on the movie plays and the button changes to pause - then of course when clicked again the movie pauses and the button changes back to play. Thanks for the help!

Flash XML Play/Pause Button?
Hi,
I have a flash xml slide show. I need to create a play pause toggle button that will stop the xml slide show and start it again.
Does anyone know how I can do this?

Here is the actionscript:

Code:
function loadXML(loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
image = [];
caption = [];
total = xmlNode.childNodes.length;
for (i = 0; i < total; i++)
{
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
caption[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
} // end of for
firstImage1();
}
else
{
content = "file not loaded!";
} // end else if
} // End of the function
function nextImage()
{
if (p < total - 1)
{
++p;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie("photos/" + image[p], 1);
caption_txt.text = caption[p];
} // end if
} // end if
} // End of the function
function nextImage1()
{
if (p < total - 1)
{
++p;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie("photos/" + image[p], 1);
caption_txt.text = caption[p];
slideshow();
} // end if
} // end if
} // End of the function
function prevImage()
{
if (p > 0)
{
--p;
picture._alpha = 0;
picture.loadMovie("photos/" + image[p], 1);
caption_txt.text = caption[p];
} // end if
} // End of the function
function firstImage()
{
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie("photos/" + image[0], 1);
caption_txt.text = caption[0];
} // end if
} // End of the function
function firstImage1()
{
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie("photos/" + image[0], 1);
caption_txt.text = caption[0];
slideshow();
} // end if
} // End of the function
function slideshow()
{
function pause_slideshow()
{
clearInterval(myInterval);
if (p == total - 1)
{
p = 0;
firstImage1();
}
else
{
nextImage1();
} // end else if
} // End of the function
myInterval = setInterval(pause_slideshow, 4000);
} // End of the function
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("photos.xml");
listen = new Object();
listen.onKeyDown = function ()
{
if (Key.getCode() == 37)
{
prevImage();
}
else if (Key.getCode() == 39)
{
nextImage();
} // end else if
};
Key.addListener(listen);
previous_btn.onRelease = function ()
{
prevImage();
};
next_btn.onRelease = function ()
{
nextImage();
};
p = 0;
this.onEnterFrame = function ()
{
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize)
{
preloader.preload_bar._xscale = 100 * loaded / filesize;
}
else
{
preloader._visible = false;
if (picture._alpha < 100)
{
picture._alpha = picture._alpha + 10;
} // end if
} // end else if
};

////////////Try the Pause and Play Toggle button down here ////////////////////



/*var playState:Boolean=true;
btn_mc.onRollOver=function(){
this.gotoAndStop(2);
}
btn_mc.onRollOut=function(){
this.gotoAndStop(1);
}
*/


/////////this is where it goes to stop and start//////////////



btn_mc.onRelease=function(){
this.gotoAndStop(1);
if(playState){
playState=false;
this.btnTxt_mc.gotoAndStop(2);
this._parent.stop();
}else{
playState=true;
this.btnTxt_mc.gotoAndStop(1);
this._parent.play();
}
}

NetStream Play & Pause Button
I have been using the gotoand learn tutorials to make a flv player i am now trying to make a play and pause toggle button for a netstream connection.

I know i have to create a movie clip with the button play and pause buttons in but what actionscript do i need to check if the video is playing
and display required button.

thanks

Play Pause Toggle Button Help
heres my code as of now.....let me know
meaning if the movie is over, and i hit the play button again, it replays the movie.


playButton.onRelease = function() {
ns.pause();
}

Play/pause Button And Autoplay
What is the best way to handle play/pause buttons? I want to have a play button and when you click play it plays and then the pause buttons shows. When you click pause it pauses and the pause button shows. Then how do I deal with autoplay with that?

The issue is I don't want to play the video unless clicked or have on autostart. So when you click first time you would use play(). Then second time you would use pause(). The third time???? Won't things mess up with making buttons visible and not and such?

Play And Pause Mp3 Sound With One Button
Hi, I am an absolute beginner in Flash.. and I’m trying to make a.script for one button witch will play and pause mp3 sound from my library. Can someone help?
BM

Play/pause Button Actionscript
Hi guys,

I have an embedded video in my application and was just wondering what I would say in an if else statement if I am trying to get a button to perform both play and pause functions. Please include all code, even on the release part. Ta

Play/pause Button Actionscript
Hi I was wondering how to make a video playable again once the full the duration of the video has played. I press play and nothing happens. For the record my play button is also used as a pause button.

Here is the actionscript I'm using:

on (release){
ns.pause();
if (stopped)
{
ns.seek(0)
ns.play();
stopped=false;
}
}

Copyright © 2005-08 www.BigResource.com, All rights reserved