ActionScript 1/2 :: Button To Start And Stop Music?

Jan 26, 2012

I'm fairly new at AC2 (Yes, I need to update), and I have Flash CS3.I need to find out if I can have a button that when you click it, plays a music file, and then when you click it again, the music that was playing for that button would stop.I have a text box on top of a rectangle and I selected them both and converted them to a button symbol, named it MusicFile, double clicked on the new button, inserted a new keyframe in the timeline on "down" (where it says Up, Over, Down, Hit), and then dragged the music file from the library onto the button. It works fine, until I click the button a second time, and it just keeps playing as if I pushed play twice and two copies of the sound started playing.Is it possible to make the button play the music when it's clicked the first time, then stop the music that it was just playing the second time it was clicked?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Music Separate From Flash File / Still Have Start Stop Music Buttons?

Oct 11, 2009

I want a site to have background music, but when I attach the music to the file it makes it quite large ...3 meg and the site is slow to load. Is there any way of having the music separate from the flash file and still have start stop music buttons?

View 2 Replies

ActionScript 3.0 :: Stop And Start Background Music?

Feb 7, 2010

I have background music playing by using this code:

Code:
var request:URLRequest = new URLRequest("loop.swf");
var loader:Loader = new Loader()
loader.load(request);

this works great for playing the music but I don't know how to have a pause and restart button for the music.

View 7 Replies

ActionScript 2.0 :: Getting Backgorund Music To Stop And Start?

Apr 14, 2005

i'm having issues getting backgorund music to stop and start.here's how i have it set up.i have a blank swf file that has an empty MC to load up the external swf's.i also have a MC on that same blank swf file that contains the background music.on one of my external swfs has the controller for the audio.i've been using this script to control the background music:

on (release) {
_root.audio.gotoAndStop(1);
}

basically, i'm trying to turn the audio off and on thru my external swf.i have a zip file with my files in it if anyone want's to take a look at it.

View 3 Replies

ActionScript 1/2 :: When File Loads In The Browser - Music Immediately Plays And Loops Until Click A Button To Stop The Music

Mar 30, 2009

I downloaded a flash template and have modified it to suit our company but there is something that I can't do. When the file loads in the browser, music immediately plays and loops until you click a button to stop the music. On our video page, we have video
that we need to play that has sound in it. How do I get the background music to stop when my video plays without having to go up and stop the music manually. The videos are loaded via an external XML document and there are no buttons in the FLA file to link code to. the website is [URL]

View 4 Replies

ActionScript 2.0 :: Play / Pause Buttons To Stop Then Start Music?

May 23, 2005

How can I get the pause button to stop sounds and music, and the play button to start them up again? As of now, it only stops the animation, and lets the music continue.

View 1 Replies

ActionScript 1/2 :: Using Start Button To Start And Stop The Scene Or Movie?

Nov 19, 2011

Here is the action scrip that I created. Correct it if you can.

Process.visible = false;
Cycles.visible = false;
stop();

[Code]....

View 3 Replies

Create A Button To Stop And Play Music?

Dec 23, 2009

I am using flash CS4 AS 2.0.creating a button to stop the music on click and play the music on the next click. Sort of on and off music.

View 12 Replies

Professional :: Stop Music With The Click Of A Button?

Oct 13, 2011

I have a Start button on the title screen. I want the music to stop when you click on the start button. Also, I want for another music to start when you go to the next part of the animation and to stop when you click on another button.

View 5 Replies

ActionScript 2.0 :: Stop Music If A Button Is Pressed?

Sep 2, 2005

how would i stop music if a button is pressed? on (release) { stop.street.mp3?? or somthing like this?

View 2 Replies

ActionScript 3.0 :: Audio Controls - Add Play/stop Music Button On The Page?

Jun 15, 2009

I am trying to add a music track to some of the pages of my flash website, I imported the mp3 file to the library and dragged it on the stage and it plays when I test it. I want to add play/stop music button on the page, I dragged buttons from the video components to use, but I have no idea where to start with the code??

View 1 Replies

Movie Clips And Background Music - Unable To Stop Music At The End Of The Animation?

Apr 30, 2011

I'm working on an animation where I have my "dog" fighting the evil vacuum cleaner. I got most of it to work the way I want it to.

1) I have movie clips entitled pepper_mc (where my dog is supposed to be walking), swirl (where a swirly-type symbol is supposed to spin over the dead vacuum's head), and vacuum_mc (where the evil vacuum is supposed to have a swinging arm (called vacuumarm_mc) that I created using the bone tool). When I add them to the stage and test them, the animations within the movie clips don't happen.

2) I have background music that I'd like to stop playing at the end of the animation, but I'm not sure how to do that. (using the stop(); actionscript doesn't help).Where am I going wrong? I'm using Flash Pro CS5.

Here's the file --> Pepper and the Vacuum of DOOM!

View 1 Replies

ActionScript 2.0 :: Music To Continue Playing But The GetURL Function Seems To Stop The Music

Dec 13, 2005

When the movies performs the getURL action, I want the music to continue playing, but the getURL function seems to stop the music at frame 152 (where the getURL action is placed), when I wanted the music to continue to frame 257 (the end of the movie). I hope I've explained this clearly

View 3 Replies

ActionScript 3.0 :: Start / Stop Sounds On Button Not From URL

Sep 2, 2011

im using actionscript 3 with a button to play a sound, the only thing is I dont want to play the sound from a URL i want to play it from a sound imported into the library, im sure its simple I just dont know how.

[Code]...

View 7 Replies

Single Start/stop Button For Looping Movie?

Oct 25, 2009

I currently have a 23-frame multilayered single-scene animation designed to loop continuously which I would like to add to my portfolio. As such, I am adding a Play button, which I would like to toggle to a Stop (or Pause) button. I currently have an instance of the Play button ("playButton") created.
 
(You can find this at pineboxmovingco.com/gear_redux.swf)
 
Besides imploring your assistance in providing the code, I must also ask if this requires (and best practice for) inserting an additional frame at the beginning for the ActionScript, as well as where/what layer to add an instance of the Stop button. I would like the movie to be stopped by default, presenting the Play button, toggling to the Stop button, and back to the Play button, each upon release.

View 8 Replies

ActionScript 3.0 :: Code Not Working For Start And Stop Button?

Feb 20, 2011

Ok so I have this simple animation I created of a circle that moves from one side of the stage to the other. I have added a new layer and called it buttons. On this layer I have added 2 buttons. One for start and another one for stop. The purpose is to get my circle to move from one side of the stage to the other but be able to use my buttons so that I can start and stop the animations at random times during playback. I fixed all my compiler errors now the problem lies in that everytime I click the start or the stop button I get an output error. I have a 3rd layer in which is titled actions and this is where all my code is posted. I removed that layer and placed my code in the first frame of the buttons layer to see if this would change anything but I still get the same output errors. So I just added back my actions layer. What could I be doing wrong? I have made sure to name all my movie clips and buttons correctly and I even added an instance name to them.[code]Here is my code and the errors I am getting when I press the play and stop button on test.Error #1009: Cannot access a property or method of a null object reference.

View 10 Replies

ActionScript 3.0 :: One Button For Sound Start & Stop Flash?

Mar 18, 2011

I am trying to create a sound button to start a sound and then stop it when clicked again. I thought it would be easy because there is a code snippet for "click to play/stop sound"
 
I have my sound file in my library.
 
Below is the code that is not working:
 
Instructions:1. Replace [URL]below with the desired URL address of your sound file. Keep the quotation marks ("").*/
 
CYOA2bttn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound_11);
var fl_SC_11:SoundChannel;
//This variable keeps track of whether you want to play or stop the soundvar fl_ToPlay_11:Boolean = true;
Proxy-Connection: keep-alive Cache-Control: max-age=0 Cp>function

[Code]....

View 7 Replies

ActionScript 2.0 :: Scripting A Button To Stop & Start A MC Timeline?

May 24, 2003

I am a main timeline, with a movie clip that I want to loop infinitly, until a button is clicked, once the button is clicked I want it to stop the movie clip timeline, once the button is clicked again I want it to start the movie clip timeline again.

I am not the greatest actionscripter, I understand it I just have a bit of trouble writing the syntax myself.

View 5 Replies

ActionScript 2.0 :: Button To Stop And Start Random Movement

Jul 19, 2003

i successfully got the random tuorial working. now i'm lokking for a function for a button to stop and start the random movement at will. i dont want to change frames, im just need a function to break the movement and make the mcs stay put...

View 2 Replies

ActionScript 3.0 :: Stop At Frame 1 And Wait For Click On Start Button

May 7, 2010

I wrote the following code to have flash stop on frame 1 and wait for the click on the start button. I will use the animation in Connect Pro and without a Start button, the audio starts before the video. Here is the code and following is the error I get in the Compiler when I play the animation. The button does have the instance name play_btn :

play_btn.addEventListener(MouseEvent.CLICK, buttonClicked);
function buttonClicked(event:MouseEvent):void {
gotoAndPlay(2);
} stop();

The error I get is:
Location: Scene=Scene1, layer=actions, frame=1, line 3
Description: The class or interface 'MouseEvent' could not be loaded.
Source: Function buttonClicked(event:MouseEvent);void

View 3 Replies

Actionscript 3.0 :: Stop Button To Reset Current Song To Start?

Jan 22, 2011

have been looking for the right solution to my little problem and not found anything that works with my project.I have a fully functional mp3 player built in flash cs5 with AS3 and I would love to make the stop button reset the song to the beginning instead of pausing it like it is doing at the moment.. My code for the whole app is as follows :

/////////////////////////
/////// CODE FOR FRAME 1
/////////////////////////

[code].....

View 1 Replies

ActionScript 2.0 :: Start() Stop() Movie Clip When Press Button?

Apr 29, 2004

i'm trying to write the code for a flash animation which uses different movie clips and buttons.all the movie clips are in the same layer but i've written code to make all but one invisible when the animation loads.

dance._visible = false;
harmonica._visible = false;
violin._visible = false;

i've then got buttons which are supposed to make the movie clips visible, but then disapear again after the clip has played.i want to be able to press one button to have one clip start playing, but then i want to be able to press another button which stops that movie clip and starts a new one playing.this is what i came up with but it doesn't work

on (press) {
violin.stop();
harmonica.stop();[code]....

this script is from one of the buttons which is supposed to start the movieclip harmonica and stop violin playing.i've got the same code for violin but the other way round.when i press a button it works fine and plays the clip which then disapears (leaving a default clip which plays all the time visible) but pressing buttons to interrupt the clip and play another one don't work properly. the movie clips don't stop and reset when they are interupted. they kind of pause instead. when i go to play a clip that has previously been interrupted it starts from where it has been paused and not from the beginning

View 4 Replies

ActionScript 3.0 :: Start A Music With Animation In Mute

Nov 1, 2010

I'd like to start a music with my animation in mute (volume 0), and then, use a "ON/OFF" button to hear the sound (volume 1 or 0).

View 6 Replies

ActionScript 2.0 :: Make Music Start Automatically?

Nov 22, 2010

I have a flash file with a volume controller. everything works the problem is that music wont start unless play is pressed and volume gets turned up. Obviously is something to do with the coding in the script. All I want is the music to start automatically and the volume to be up already once song is loaded. I tried playing with the script but no luck.

View 9 Replies

ActionScript 3.0 :: Stop It And Start Again With A "end Turn" Button?

Aug 28, 2010

I am creating a card game in flash and to do the turns i used the while loop, but that made my script infinity and it is causing trouble, how can i stop the script and start it again with a "end turn" button?

View 9 Replies

Professional :: Sound Class - Page Music Does Not Start

Apr 19, 2011

I have a Flash 8 site that plays music in the background. When I click on one of the menu choices, the timeline jumps to another frame where the selected page is. Once at that page, I want the background music to stop and the page's music to start. Here is what I have:

Attached to frame 1:
var s:Sound=new Sound(); // to initialize a sound instances
then attached to each page keyframe:
stopAllSounds();
s.attachSound("thelinkageidofthesoundthatcorrespondstothispage");
s.start();

When the timeline jumps to the page frame, the background music stops but the page's music doesn't start.

View 5 Replies

ActionScript 2.0 :: MP3 Player - Start Playing Music On Click

Sep 16, 2009

I followed the tutorial about making your own mp3player but I don't want the music to start directly I want it to start after I clicked on play ...
Code:
// Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
[Code] .....

View 0 Replies

ActionScript 2.0 :: Volume Controller Doesnt Start Music?

Dec 6, 2010

I have a volume controller with a simple play and stop button. I want music to start on its on when site is loaded, but music deosnt start unless play is pressed and volume is turned up.Thia is the script I have, how do I change it simply to make to song start automatically when site loads????

onClipEvent (load) {
mySound = new Sound();
mySound.loadSound("nachomp3.mp3", false);

[code].....

View 2 Replies

Stop The Playing Sound And Start Playing The Button?

Oct 3, 2009

So I made a few buttons with sounds within them and when I publish it they work just fine. But what I want them to do is;

Say I click a Button.The sound starts playing.Then I click it again, before the sounds done playing.I want it to stop the playing sound and start playing the button I just clicked on, whether it be the same button, or a different one.Right now it just ends up sounds like an echo because it'll play it as many times as you click it.

View 2 Replies

ActionScript 2.0 :: Controlling Sound - Music Automatically Start When The User Enters The Frame

Sep 15, 2011

So I am a complete novice at actionscript as was evident in my attempts to figure this out on my own. I have the following code to control the "Songs" section of my website and I would like the following features:

1. Not have the music automatically start when the user enters the frame. (I thought this was due to line 3 code but it still played after I deleted that code)

2. Add a "Back" button to go back 1 song.I currently have it set up with the following code on my "Songs" Page:

[Code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved