Professional :: Stopping Sound Playing On Button Click?
May 3, 2010
I found this code to play sound:
myButton_btn.addEventListener(MouseEvent.CLICK, buttonIsClicked); [code]....
I got it working fine, but was wondering how to program a function for another button to stop stop playing that sound?I tried a function with snd.stop(); but that seems to be incorrect.
View 6 Replies
Similar Posts:
Feb 26, 2010
I'm trying to get a button to toggle playing or stopping an mp3 if I click it or hit the space bar. The code I have does that but it does something funny I don't understand. This is the code:
var s:Sound = new Sound(new URLRequest("song.mp3"));
var sc:SoundChannel;
var playtggl:int = 1;
[code]....
As you can see I've added two event listeners on the button, one for the mouse and for the spacebar. Thing is everytime I hit the spacebar, my function for the mouse click fires up. I don't understand how this is happening.Also, how do you have the event listener listen for a spacebar event without having to first focus on the button by clicking it with the mouse?
View 2 Replies
Jun 14, 2007
I am making a kiosk based on another designers layout where I work... I am not going to get in the details, but the work seems sort of an unorthadox way of using flash - anyways...
It is basically an interactive slide show... play, pause, previous slide, next slide...
Each SWF that is loaded in is around 15000 frames in lenght (right under that magical 16000 number) - the audio voice overs are on the time line one after another... so when the slide changes the voice over matches the slide current slide... there are 31 slide JPGs and 31 mp3 files that are divided between 8 SWFs.
The issue I am having is that when you are one the first "SWF" (slides 1-5)... and you move from slide 1 to 2 before the audio is done playing... it will keep playing the audio from slide one and then start the audio from slide to ... so on and so forth until you get to slide 6 - which is a new SWF that is loaded...
I know that I need to use a stop sound script somehow... on the first frame of each of the following slides so that it stops the currently playing sound... if it hasn't already finished...
if you let the presentation go it works fine... but when you move forward and back... the sound gets garbled....
View 8 Replies
Feb 26, 2009
I'm stuck while trying to playing some sound and stopping the others. What I do is : I'm using a linkage to get access to my sound. For example I have 5 linkage sound. I need to play just one specific sound and stop the others. I create a new Sound() and a new SoundChannel() for each one , and put it all in Array. But when I'm trying to stop the others by stopping it's channel, it won't work: The snippet is somewhat like this :
Code:
for(i=0;i<song_.length;i++)
{
if(snd==song_[i].clas)
[Code]....
I have an array of object that have a sound and channel for each one.
View 1 Replies
Sep 13, 2010
I had been through your post which telss about playing sound using AS3. It was really helpfull. I just wanted to know how we can stop the sound using a Button click event.
View 1 Replies
Sep 7, 2010
So I have a main swf and when the user clicks on certain buttons, an external swf is added to the stage, which is an mp3 player.There is a sound playing in the main swf that I want to pause when that swf has been added to the stage and then resume when it is removed.How would I accomplish that? I assumed I would put a conditional statement that if the loaded swf's current frame was less than 16 (16 is when it closes), to pause the sound and if it was larger than 16 to resume the sound at its current position. But this isnt working.
ActionScript Code:
var soundClip:Sound=new Sound();
var sndChannel:SoundChannel=new SoundChannel();
[code]....
View 0 Replies
May 20, 2010
I have a couple of sound clips that I'd like to be able to play. I want one clip to play per frame (the frames are timed to a certain length through a set interval action). When I advance to the next frame (either when the timer runs out or I click a button) I want the first frame's clip to stop and the second clip to begin. IE: I have clip A and clip B which correspond to Frame A and Frame B. I go to frame A and clip A plays, I go to Frame B and Clip B plays (Clip A having stopped).
View 3 Replies
Jun 9, 2010
i have a graphic that basically is set to pivot onto the screen using a motion tween. my problem is once the animation plays the graphic disappears whereas i would like it to remain on screen and displaying its last frame
View 2 Replies
Nov 13, 2010
I have a sound clip that I'm loading externally into my flash file. The code I'm using looks like this and is placed in the as layer on the first frame,
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var myTransform = new SoundTransform();
var lastPosition:Number = 0;
mySound.load(new URLRequest("introaudio.mp3"));
myChannel = mySound.play();
[Code]....
View 14 Replies
Feb 23, 2010
I don't use Flash that much so the question may sound simple, but how do I pause audio in a timeline? I have added the audio, play and stop button. When I test it works fine, but I can't figure out how to add the pause button, or the play/pause button.
View 2 Replies
Apr 4, 2010
Is it possible to stop a sound playing without a button? I have background music on frame 1 but before I move onto frame 2 I want the sound to stop. I have 5 buttons on frame 1 to lead to different frames but I do not want them to control the sound. I also do not want to use stop all sounds on the next frame as I want sounds to work on those pages. The script below is to start the sound so how do I stop it from continuing onto the next frames when the control buttons are clicked.
View 6 Replies
Jan 29, 2011
I have some code on my button that should play my sound file, but when I run my FLA, it shows an error. The error says, "Scene 1, Layer 'Layer 1', Frame 1, Line 1 1046: Type was not found or was not a compile-time constant: button1" Does anyone know how to fix this? I have exported the sound in actionscript but nothing?
View 2 Replies
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
Aug 25, 2011
I have a website in Flash CS4. When testing the movie, my swf file plays. When I access another menu button, the movie still plays and you still hear the sound. I have the skin where the user can stop the movie before going to other pages in the site but my Question is: How can I get the movie to stop playing if another menu button is clicked? I ask because when I go to another page and come back, the video is not showing but I still hear the audio.
View 7 Replies
Dec 6, 2011
ok so i have a button that plays an animation for fire when held down. and when realsed goes to and stops and frame one. when it reaches the end of the time line it goes to and plays at frame 10 and goes back to the end of the timeline. I have a sound for the fire animation that plays for the effect. The problem is the sound keeps going untill its over even if the button isnt held down. and when the playhead reaches the end of the timeline it goes to and plays and frame 10 and it replays the sound. if i hold it down it will just keep playing the sound over and over from start to finish. what i want it to do it when i hold the button down i want it to play the sound and when released it stops the sound where ever it is at. I also dont the sound to play again if there is a sound already going to stop it from playing 20 sounds at one time it gets loud and you need asprin after about 5 seconds of that.
View 2 Replies
Nov 8, 2009
I'm designing an interface for a class, and the buttons that I am using all have multiple functions.For example, when the story button is clicked, I need the mc to stop playing and change to text (in the same window/screen, just no mc playing). The mc is 31 frames long, but if there's a way to just make it loop continuously until told not to, Currently, my code looks like this:
stop();
story_btn.addEventListener(MouseEvent.CLICK,story);
function story(event:MouseEvent):void { gotoAndStop(32);}credits_btn.addEventListener(MouseEvent.CLICK,credits);[code]...
When I click the button, the mc does not stop playing and the text does not show up.
View 6 Replies
Feb 28, 2012
I'm trying to stop my flash animation at a certain frame (allowing the person to click a button to go to another page).When I instert the stop code on a keyframe on my actions layer at the specified frame I want it to stop at it simply keeps looping my movie. The second problem I'm having is making my menu bar like you would see and use on a website.You click the Home button and it goes to the home page.
View 9 Replies
Oct 17, 2010
I have 1.mp3 beside my .fla file and when I tried to run a movie test, it doesn't play any sounds. Only the stage has a glitch was it keep loop frame 1 and 2.
var mySoundReq:URLRequest = new URLRequest("1.mp3");
var mySound:Sound = new Sound();
mySound.load(mySoundReq);
mySound.addEventListener(Event.COMPLETE, playSong);
function playSong(event:Event):void {
mySound.play();
}
My test Movie with button on stage: [URL]
View 1 Replies
May 16, 2010
I've run into a bit of a problem using Adobe's CS3 flash program in terms of lip syncing... I can place the sound files in the timeline at whichever point I like and so forth, but I have no way to play them in such a way where I can adequately make lip syncs. It's hard to explain, but in flash MX I would merely click the timeline, drag the cursor along it, and it would play the sounds as it did the frames, one piece at a time. That way I could tell where the consonants were and therefore where to change my characters' lips. This is not the same as simply hitting "enter" and letting the sound play in its entirety.
View 4 Replies
May 26, 2010
I can download video from youtube as FLV.Want to play back in my Flash swf file without sound.How do I mute the sound during user playback?
View 1 Replies
Dec 11, 2009
I'm trying to make a stop button to make it stop playing the sound. But I get an error saying:
TypeError: Error #1006: stop is not a function.
at sound/SoundStop()
Here is the function for my stop button:
function SoundStop(event:MouseEvent):void {
cs.stop();
isPlaying:false
}
View 5 Replies
May 1, 2010
I have a Button named "Bt1P" that when I click on it, the Sound "S1.mp3" begin to play.
[Code]...
My question is, what is the right code to tell this Button not to repeatedly play "S1.mp3" while it is already Playing!because when i click it for the 2nd and 3rd time, the file overlaped, and 3 same sounds play together at once.
View 3 Replies
May 23, 2007
i can in AS 1.0 attach a sound and play it on rollover fine...
Pretty much i have a button when you roll over it plays a sound thats it...very simple....i also know i can do it on the keyframes but i was hoping to do it dynamically as my site is completely created using AS barely no keyframes and i do not wish to start...
View 2 Replies
Nov 7, 2009
I really just need help automatically loading one swf once the other is done playing without a button click.a.swf has several buttons. When a button is clicked an animation plays within a.swf. If button b is pressed, once it's animation plays in a.swf, I need it to automatically jump to b.swf.I have no idea where to go.
View 0 Replies
Jul 29, 2011
I have made a 5 min animation with stream sound. Its playing perfectly in PC. But in mac, its not playing. Stream sound starts from frame 60. So mac plays the swf plays till 60 frame, after that it pauses. I tried importing different sound format (wav, aif, mp3) and tried with all sound export setting but the problem remain same; its playing only till 60.When i removed the sound, it played till end. Even with event sound, it plays till end. But with stream sound, the problem. The problem is only in mac; in pc its perfect.I am using VMware Mac OS x leopard in window xp for testing purpose.
View 2 Replies
Oct 11, 2011
How to make sanpshot from playing video through button click? (to local machine)
View 1 Replies
Apr 9, 2009
I'm making a mp3 player using flash. when i test the movie it starts playing fine but when i click the next button the current track keeps playing while the next one starts. plus the stop button it's not working. here is the code.
[Code]...
View 1 Replies
Jul 8, 2010
How can I edit sound from a timeline if I don't have the original sound file? When I right-click my sound in the library, I can't open it in any sound editor program. What do I do?
View 3 Replies
Aug 4, 2010
I have a movie clip with a sound at the beginning of my project, and when I click a button in another scene it starts playing the voiceover from that clip. I don't have the button linked to that clip.
View 2 Replies
Sep 11, 2006
I want to play a sound on click of a button. I can do this in AS 2.0
//Action Script 2.0
Code:
snd=new Sound();
snd.attachSound("try");
snd.start();
[Code].....
View 11 Replies