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




AS3 Stop Event And Play Button



How exactly do I code a simple stop event in AS3? I also want to code a normal reply button that goes to frame 1 of my current scene. Any idea how to do that?
Thanks a lot



Ultrashock Forums > Flash > ActionScript
Posted on: 2008-11-23


View Complete Forum Thread with Replies

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

Not Receiving OnStatus Event After "NetStream.Play.Stop" Event Is Received
Hi,

I am trying to play flv file in swf, using NetStream. I have registered for onStatus event. I receive all the events till I receive "NetStream.Buffer.Flush" & "NetStream.Play.Stop" in same order at the end of the video... After that when I drag the video using seek and play the video again, I don't receive any events in registered call back onStatus function...

I need to make status text updates on video, even after video has fully downloaded and stopped & if replayed... Any idea what is going on and what I need to do different here so that I continue to receive onStatus event notifications?

Thanks In Advance...

Not Receiving OnStatus Event After "NetStream.Play.Stop" Event Is Received
Hi,

I am trying to play flv file in swf, using NetStream. I have registered for onStatus event. I receive all the events till I receive "NetStream.Buffer.Flush" & "NetStream.Play.Stop" in same order at the end of the video... After that when I drag the video using seek and play the video again, I don't receive any events in registered call back onStatus function...

I need to make status text updates on video, even after video has fully downloaded and stopped & if replayed... Any idea what is going on and what I need to do different here so that I continue to receive onStatus event notifications?

Thanks In Advance...

I Would Like To Play And Then Goto Scene Only If Button Event
I would like to play and then goto scene only if button event is true
so is there someone who can help me to build the script to do so

example: scene1 is playing and stoping into the midle
i have 3 buttons
if one of these is click the scene1 continue to play and
at the end goto the scene coresponding to the button clicked.

I have no idea to make it work

Change Listener Event Makes Button Stop Working
I have come a long way and I almost have my app working, except for one anoying little problem; I have a menuBar component on stage. In my script I've added a listener for the change event:


ActionScript Code:
listen.change = function(evt) {
    var menu = evt.menu;
    var item = evt.menuItem;
    doClicked(item);
};
mainMenuBar.addEventListener("change", listen);


the 'doClicked' function performs the creation of components on stage using an XML file:


ActionScript Code:
doClicked = function (item) {
    var aNode:XMLNode = item;
    if(aNode.nextSibling != null){
        subForward._visible = true;
        nextNode = aNode.nextSibling;
    }else{
        subForward._visible = false;
    }
    if(aNode.previousSibling != null){
        subBackward._visible = true;
        prevNode = aNode.previousSibling;
    }else{
        subBackward._visible = false;
    }   
    delete nodesDP;
    var nodesDP = new XML();
    var submenu = item.attributes.pageMenu;
    doSubMenu(submenu);
    // Load page template XML file
    pageFile = id+".xml";
    nodesDP.load(pageFile);
    nodesDP.ignoreWhite = true;
    nodesDP.onLoad = function(success) {
        if (success) {
            node.dataProvider = nodesDP;
            pagina = nodesDP.childNodes[0];
            if (nodesDP.firstChild != null) {
                //fillStage(pagina);
            }
        } else {
            trace("error loading XML file");
        }
    };
};


Already on stage there are the subForward and subBackward movieClips which function as buttons. Both have an onRelease function assigned to them:


ActionScript Code:
subForward.onRelease = function(){
    doClicked(nextNode);
}
 
subBackward.onRelease = function(){
    doClicked(prevNode);
}


Now comes the real problem, when click one of the two buttons, the first time it works, but when not moving the mouse and clicking again, nothing happens? Very strange...
If I run the 'doClicked' function outside the listener event, they do work fine.

Anyone have any idea how to solve this???

Play/stop Button
i created a play/stop button and it works fine. My problem enlies in the size of it. I want it to fit in a 50 by 50 box and so it wont be needed to scroll. i tried this but it is still too large for the box which is 75x75..Is there any solution?

Play Button And Stop Help.
I have a sword idea that is suppose to have 3 stages of animation. I am tyring to get the play button to play each stage at the end of each animation and start the animation again at the end of the last stage. I'm still new to this and I'm not sure what I'm doing wrong but the button doesn't work and it just plays the entire animation without stopping after each stage. I have each stage labeled where it is suppose to stop but I'm not sure what I'm doing wrong. If anyone could help me out it would be greatly appreciated!

[F8] Stop/play Button Help
Hello- I am new to the forums and need some serious help. I am learning flash, and had to add a play and stop button to a banner with sound. Well, everything is set up but the buttons do not play or stop. I am completely lost, I have tried various action scripts and none work. I think I am doing something in the banner setup wrong, but I'm not sure what. I can send the flash document to someone if that will help. It's 368kb so I can't upload it straight to the post. Thanks a ton.

Stop And Play Button
Hi everyone, i have added sound to a frame, but need to make a stop and play button. Any help would be appreciated.

Help With Stop And Play Button
I have pause button (pausebtn) on frame 1 (with 'stop()') and play button (playbtn) on frame 2 (with 'stop()') of 'moviebtn' and placed the script below in parent. Problem: when button is pressed it goes to frame 2 but when pressed again, it refuses to return to frame 1. WHY??

moviebtn.pausebtn.onRelease = function () {
moviebtn.gotoAndPlay(2);
};

moviebtn.playbtn.onRelease = function () {
moviebtn.gotoAndPlay(1);
};

Thanks in advance for any help.

Help With Stop And Play Button
I have pause button (pausebtn) on frame 1 (with 'stop()') and play button (playbtn) on frame 2 (with 'stop()') of 'moviebtn' and placed the script below in parent. Problem: when button is pressed it goes to frame 2 but when pressed again, it refuses to return to frame 1. WHY??

moviebtn.pausebtn.onRelease = function () {
moviebtn.gotoAndPlay(2);
};

moviebtn.playbtn.onRelease = function () {
moviebtn.gotoAndPlay(1);
};


Thanks in advance for any help.

One Button To Play, Stop 2 Different Mc?
im struggling with this one here.
I have one button that i want to play 2 things at the same time. Then one button i want to stop those 2 at the same time.
Below is what i have and it doesnt work. It only plays and stops mc2.
???


Code:

playbutton.addEventListener(MouseEvent.CLICK, onClickplay);
stopbutton.addEventListener(MouseEvent.CLICK, onClickstop);


function onClickplay(event:MouseEvent):void {
mc1,mc2.play();
}

function onClickstop(event:MouseEvent):void {
mc1,mc2.stop();
}

Play/Stop Button
I have a flash game and want to put a button so the user can chose to have the sound on or off. I have made the stop button and placed it in the scene and I´ve put : on (release) {stopAllSounds();
}

This works, but I really would want a button which shows stop/play in the same button,how do I make this button and what actionscript do I use and where???

Play / Stop Button
this is too easy - but I cant work it out...

I have an MC which plays when movie is loaded. I have a button which I want to use to stop the MC playback. Then when it has stopped, have the same button to make it play. Simple.. yep .. Well my code went like this:

if (roller.stop = true) {
btn.onRelease = function (){
roller.play();
}
}

if (roller.play = true){
btn.onRelease = function () {
roller.stop();
}
}

where have I gone wrrong?

cheers

Flash MX : How To Play And Then Goto If A Button Event Occur ?
I would like to play and then goto scene only if button event is true
so is there someone who can help me to build the script to do so

example: scene1 is playing and stoping into the midle
i have 3 buttons
if one of these is click the scene1 continue to play and
at the end goto the scene coresponding to the button clicked.

I had tried this :

\for the first button on the first frame of the scene 1

on (release) {
set(001, true);
play();
}

\for the second button on the first frame of the scene 1

on (release) {
set(001, true);
play();
}

\for the last frame of the scene 1

if (001) {
gotoAndStop("Scene 3", 1);
if (002) {
gotoAndStop("Scene 4", 1);
play();
}
}

---------------------------------------------------------------------
It still doesn't work...
is there someone who can help me ?
It could be usefull !!!

W.

Flash MX : How To Play And Then Goto If A Button Event Occur ?
I would like to play and then goto scene only if button event is true
so is there someone who can help me to build the script to do so

example: scene1 is playing and stoping into the midle
i have 3 buttons
if one of these is click the scene1 continue to play and
at the end goto the scene coresponding to the button clicked.

I had tried this :

\for the first button on the first frame of the scene 1

on (release) {
set(001, true);
play();
}

\for the second button on the first frame of the scene 1

on (release) {
set(001, true);
play();
}

\for the last frame of the scene 1

if (001) {
gotoAndStop("Scene 3", 1);
if (002) {
gotoAndStop("Scene 4", 1);
play();
}
}

---------------------------------------------------------------------
It still doesn't work...
is there someone who can help me ?
It could be usefull !!!

W.

Play/stop Button In One To Toggle (?)
Hi,

I know I've seen this question brought up on previous posts..
How do I use just one button to toggle between play and stop function. Also, how do I get the toggle to switch image from stop to play or viceversa?

So, when the stop button is pressed, it stops the movie and the image changes to play button and when pressed, it plays the movie again?

any suggestions will be helpful.

P.S. I also want to know if there is a way to preload all the external movies on the first initial movie preload?

Thanks.

Play And Stop Button Sound
hey people how can i make a play and stop button for sound on my flash movie?

I am Using flash 5.

Ps. I have a stop button and a play button.

Play And Stop Button For Sound
hey people how can i make a play and stop button for my sound on my flash movie?

I am Using flash 5.

Ps. I have a stop button and a play button.

How Can I Make A Play And Stop Button
i want to make a button thet stop sound and the other one play sound i can make stop one but not play one can any body help me
thanx

Stop/play Button In Slideshow With Xml?
hi, is there a way to have a stop/pause and play button in a Flash slideshow using xml. Since there is only one frame in the .fla file, and all the content are loading externally from the xml, how could I pause/stop the slideshow? thanks.

Play And Stop Movieclip With Button
Hi ,
I'm trying to make a movie clip play by clicking a button to start and stop by releasing the button. But so far, my movie clip starts even before I click the button and keep looping.

Here is the code I entered:

import flash.events.EventDispatcher;
import flash.display.MovieClip;
this.stop();
function startMovie(event:MouseEvent) :void {
this.play();}
function stopMovie(event:MouseEvent) :void {
this.stop ();}
pub_Btn.addEventListener(MouseEvent.MOUSE_DOWN,sta rtMovie);
pub_Btn.addEventListener(MouseEvent.MOUSE_UP,stopM ovie);

What am I missing? thanks!!

Stop And Play Function In One Button
hello everyone

i have a Button that contains a Movieclip playing.. now, i want it to STOP when i click on it and then RESUME when i click it again.

dats all. thanks in advance.

When Button Down Play MC In Reverse When Up Stop
Hello AS3 Gurus!

I am having a lot of problems getting the AS3 Timer class to replace the functionality of AS2's setInterval.

You can download the FLA here, to see what I have so far:
download_fla

What I want to have happen is as follows:
(1) Clicking on the certain peel, shows a different "layer" of a product that is on a turntable (works as desired).

(2) Clicking the right facing arrow rotates the product to the right and loops around and around until the mouse button is released (works as desired).

(3) Clicking the left facing arrow rotates the product to the left (playing the movieClip in reverse in an indefinite loop) until the mouse button is released (this I can sort of get to work -- it plays in reverse, but does not stop when the mouse button is released. Also, it does not loop -- in reverse -- continuously until button is released and all buttons become inoperable after pushing the left arrow the first time).
I cannot figure out how to "kill" the timer event to stop the turntable on button up and I cannot figure out how to have it loop continuously in reverse.

I would sell my soul for a .playReverse(); method!

Can anyone shed any light on the problem?

Also, there is commented out code in the FLA of how I used to solve this problem in AS2. If I could hammer this code into AS3 format/syntax, I would be happy with that too -- The most elegant solution is what I am after.

Any input is greatly appreciated.

Anyone up to the challenge?

Regards,

-john

Stop/Play Movie/button
Right,
once again, I've got this idea for making a nice page hihi.

Allright, here goes;

-I record something from a game. Edit those movies. And save them as separate files.

-In flash, I load up the MAIN movie f.e., then I create an invisable button over some parts...when its clicked, it has to start playing movie2.mpg f.e.
And back, so when someone is done looking at page2(movie2.mpg) is has to go back to the main movie.

Now, What I need to know is;

The commands for loading a movie the correct way.
Import those movies
Preload? I don't know how big the files are gonna be, so... I think something around 300-600kb.

Tia !

Play/ Stop Button Problem
I made a fading kirupa logo just for practice, and decided that making a play/stop button would be a gud idea seeing as i had never done it before. but i dont know where to start.

my button will look like [play/stop]. can anyone help thanx aj.

Simple Play And Stop Button
I simply created an movieclip called it themusic as instance
and put a sound init

Now on the firstframe i added these actions,

the problem is the music just keeps going , it has no effect

the code

Code:

play_btn.onPress = function ()
{
trace('playing' + themusic);
//themusic.stopAllSounds();
themusic.play();


};
stop_btn.onPress = function ()
{

trace('stopping' + themusic);
themusic.stop();


};
Any ideas what im doing wrong,
it must be realllllllllllllllllllllllllllly simple , but i am lost

ps the trace does show up when i click them buttons

Stop/Play Button For Xml Slideshow
Hi,

I recently added this xml flash slideshow to my site "http://www.kirupa.com/developer/mx2004/xml_slideshow.htm".

I was wondering if anyone knows how to add a "stop/play" button to this?

Thanks,

N4th4N

Stop/Play Button For Xml Slideshow
Hi,

I recently added this xml flash slideshow to my site "http://www.kirupa.com/developer/mx2004/xml_slideshow.htm".

I was wondering if anyone knows how to add a "stop/play" button to this?

Thanks,

N4th4N

Stop/Play Movie/button
Right,
once again, I've got this idea for making a nice page hihi.

Allright, here goes;

-I record something from a game. Edit those movies. And save them as separate files.

-In flash, I load up the MAIN movie f.e., then I create an invisable button over some parts...when its clicked, it has to start playing movie2.mpg f.e.
And back, so when someone is done looking at page2(movie2.mpg) is has to go back to the main movie.

Now, What I need to know is;

The commands for loading a movie the correct way.
Import those movies
Preload? I don't know how big the files are gonna be, so... I think something around 300-600kb.

Tia !

Play/ Stop Button Problem
I made a fading kirupa logo just for practice, and decided that making a play/stop button would be a gud idea seeing as i had never done it before. but i dont know where to start.

my button will look like [play/stop]. can anyone help thanx aj.

Play And Stop Button For Sound
I would like to create 2 simple buttons fot example a round button for playing my sound and a triangle for stopping my sound.creating the buttons and stuff is not the problem but i dont know wich actionscript i should use to get the sound started en stoped when i click on my button?

Straming Sound With Play And Stop Button
i have created a stop and play buton which is controling a audio loop on my current website. But how do i get the sound to loop automatically without the user having to press the play button for it to play. whilst still having the option to stop it.
thanks to all
tony

One Button Stop/play Sound Object - MX
I'm using MX and taken some Flashkit tutorials on sound objects, but I can't seem to get one thing to work. I'm trying to create one button that, when clicked, stops a sound object if it's playing and start it when it's not playing. I know how to create separate stop and play buttons, but for this project I need them combined into one button. I can get the sound object to stop, but not to play again. Any help would be much appreciated, thanks and have a great day!!!

Laters....

Tracks Assigned 2 Button & Stop And Play?
www.blusyde.com

I am trying to code buttons 1,2,3 and 4 to play music that i have attached to them. but for some reason they play at the same time and switch over to a different scene.

i want to stay on the main page. when listening. help?

or if there is a tutorial, i would also be interested in it.

Thanks

code:

on (release) {
stopAllSounds();
}
on (release) {
gotoAndPlay(5);
}

Play 1 Loop Then Stop On Button Mouseover
This is probaly a silly question, but I am REALLY NEW to flash. I was wondering how do I insert a movie clip into the over state of a button and get it to ONLY play once, not continuously. PLEASE HELP.

Urgent: I Need PLAY , PAUSE And STOP Button
Hello Gurus,

I need to have PLAY, PAUSE and STOP button for my 30 mins tutorial in flash. Please help, its urgent.

Thanx in advance.

Auto Stop With Button For Resuming Play?
Having frustrating time.

I'm developing an animated slide show, essentially.

I want the timeline to automatically stop, which isn't a problem. But then I want a mouse click or spacebar to resume playing the swf.

I assume this requires a "play" button, but I can't get it to overcome the stop action.

Please HELP!

How To Toggle A Play/stop Button On Movie?
I am like most newbies struggling with action script and seeking help on this forum I am sure, a beginner with coding in general. While some of it makes sense to me, the new AS is really confusing to me. With that being said, here is my little problem...

I have built a five scene Flash movie with small numbered buttons to navigate between different scenes somewhat easily. Where I am running in to trouble is that I also created another button with a dynamic text area with the variable name of textOutput that my first thought was to have populate this text area with either the word play or stop depending on whether the movie was playing or not and then add the button command that would start and stop the movie. I have tried several different ways to try and do this but it isn't working at all.

My latest attempt to try and finish this project up is abandon the dynamic text area idea all together and try to stick to the type of actionscript I sort of understand. That involves creating a movie clip and placing it on the main movie timeline. This movie clip I have named buttonStartStop. In this particular clip,

I created two key frames. One has a label of play with a button instance with the onRelease mouse command to "play."

on (release) {
this._parent.play();
}


The other label is to stop and has a mouse action assigned to the button to stop the movie.

on (release) {
this._parent.stop();
}

So with that being said, I have tried to code the frame action where this clip resides to have this clip move to the proper label or frame to show the appropriate action depending on the parent movie's action.

startToggle = function()
{
if (this.parent.isplaying)
{
this.is_playing = true;
gotoAndStop("stop");
}
else {
this.is_playing = false;
gotoAndStop("play");
}
}


Can someone help me out here to try and figure out how to get this function to work.

Thanks,

AzCowboy

Code For A Simple Stop/play Button
Hello All,
I've created a product demo in flash and now the client would like to add a "pause" button so the viewer can pause the demo at any point. I am new to ActionScript 3 and really need some help figuring out how to add this functionality. I tried searching the forums but I could not figure it out.

The demo has a voiceover audio track that would need to be paused as well, in case that matters for the AS code.

Many thanks.

How To Put Play & Stop Button In Flash Page
I have an swf file with code on my page. When you go there it just starts playing. No buttons or length meter. I would like to put some user buttons on but dont know where to start. Can anyone help?

Russell

A Stop Play Audio Button In Flash 5?
Hi there,

I noticed on kirupa.com that they offer a version for MX but can we do this in Flash 5? I want to be able to play a mp3 with the play button and stop it. I also want to be able to turn the volume up and down if possible.

I look at a lot of the pop artist sites who have this flash feature and want to replicate this idea.

I appreciate your time,

Rob

Mp3 Play/stop Button Scope Problem
Hi,
I have an swf (jukebox) with a new sound variable which contains loads an mp3,
there are 2 buttons that play/pause (code below):

var attach_song:Sound = new Sound();
attach_song.attachSound("track2");
playsong.onRelease = function() {
attach_song.start();
};
stopsong.onRelease = function() {
attach_song.stop();
};

The play/stop buttons work fine here, and song plays.

Now I also have a main swf which loads the swf above into an empty movie clip (loadMovie("jukebox.swf") etc). when I hit the play button via this swf nothing happens.
I have everything from the jukebox swf set up correctly I think, including linkage.

Anyone have any ideas? I presume its something to do with scope?
its been a while since I've used Flash and a little rusty!

A Stop Play Audio Button In Flash 5?
Hi there,

I noticed on kirupa.com that they offer a version for MX but can we do this in Flash 5? I want to be able to play a mp3 with the play button and stop it. I also want to be able to turn the volume up and down if possible.

I look at a lot of the pop artist sites who have this flash feature and want to replicate this idea.

I appreciate your time,

Rob

Assign Play And Stop Action To A Button
I'm very much new in Flash, I'm using Flash MX. can someone show me a step by step procedure on how to assign a play and stop action to a button. 'Coz whenever I'm adding a play action in the down state, all the actions are grayed-out and I can't add an action

please help

Play/Stop Integrated Button For Controlling Movie...
Hi there,

I have a movie that I wish to control with a single button. Initially the button graphic is a "play triangle" (like on a stereo), which sits in the corner happily as the movie plays.

What I want it to do is when the user clicks on the button, the movie stops, and the button changes to a "pause button". Then when the user clicks on that button, the movie starts up again, and the button changes back to the "play triangle".

I am still new to Flash, so please be gentle.

Thanks,

Tatlar

Problem After Adding Play/Stop Button For Music
Hello,

Can anyone help me please? I have created a flash movie by Flash 5 that embeded with a background music. But I would like to allow user to stop/play the music at anytime. Therefore, I added the Play and Stop buttons. I find that it not only stop the music but also stop the movie. After I press the play button, it will start the movie and music from the 1st frame.

I hope that the music can be stop at anytime and the music will be resumed matched with the movie after user pressed Play button.

This is my current setting:
1. I add a layer with 1st frame with the music with Sync = 'Start" and the 3rd frame with the music with Sync = "Stop".
2. I add a layer with 1st frame to add all buttons and then press F6 at the end of movie:
Right Click the Play button and input the Action code - on Press { goAndStop (1);}
Right Click the Stop button and input the Action Code - on Press { goAndStop (3);}

Can anyone tell me how can I do to get my expectation.

Many Thanks!

Samson

How To Make A Start/stop Button For A Swf To Play In Dreamweaver
I have a video that I created in Adobe Premiere and exported as a avi then compressed to a swf in Sorenson Sqeeze. My problem is that I'm trying to figure out a way to add some sort of start/stop control button to the video when I bring it into Dreamweaver. Since it's a swf (published file) I can't bring it into Flash to modify it. As it is right now, the movie clip (swf) plays as soon as you open the web page. So, my question is: Is there a way to control the clip with a start/stop button?

Thanks,
Mike

Play, Stop, Change Song Button Question
Hello,
I have about 10 songs I would like to play on a site.
could you tell me how to create a button that would allow me to change songs. I also need to have a play and stop button.
Please help.
Thanks

1 Play/Stop Flash Button - Many External Mp3s
I've searched around and can't seem to find an exact answer to my problem, so I'm hoping a FlashKit'er could lend a helping hand or at least a push in the right direction.

OK, lemme explain first. I have a very simple HTML site that has a list of ringtones for mobile phones. The list is: Artist, Title and then a Listen/Buy .gif button. The button opens a popup with information about how to 'install(?)' the ringtone onto your phone. What I would also like it to have is a simple Flash audio player, just with Play and Stop (maybe a progress timeline thing).

Now my question:

Is there a way to make one standard .swf that will play the external mp3 that is targeted from without the .swf, in just say, the HTML code or JS or even a .txt file?

The reason I ask is because I don't want to have to make 20+ seperate .swfs, plus it will make it easier for me to add or alter new ringtones in the future.

Can this be done? Can you understand my ramblings? Hahaha, I hope so.

I look forward to hearing from you all soon. Many thanx in advance...

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