ActionScript 3.0 :: Stopping Sound File After Unloading SWF Child?
Mar 12, 2010
I have added two consecutive streaming audio tracks (mp3) to a child SWF. The child SWF loads onto a parent SWF using a loader. After loading the child SWF the movieclip and audio plays without a problem. In the last frame of the child SWF a dispatchEvent is used to signal the end at which time the loader is unloaded and the playhead reset in the parent SWF.
I have a problem with stopping the audio. After the loader is unloaded and the playhead reset in the parent SWF the first audio track plays again (but not the one after it). I have been trying to use the SoundMixer.stopAll(); command to stop the audio. I have not been sucessful in preventing the audio from playing. The command only works AFTER the audio begins playing and I manually move the playhead to a frame containing the SoundMixer.stopAll(); command.
I have been reading some older threads with similar problems and haven't found a solution that works for me. I have placed the SoundMixer.stopAll(); command in every possible loaction in the main timelines of the parent and child SWF without success. Why is the sound file playing after I unload the child SWF? Is there a way to prevent it from playing again?
View 3 Replies
Similar Posts:
Jan 21, 2009
The situation is I have a swf loading another swf. The loaded contains a custom video player. When I unload the loaded swf the audio continues to play though the player is now gone.
View 3 Replies
Oct 10, 2011
The timeline of my child swf, there are layers with specific sound files in them to be in sync with my animation. Now the problem arises when I try to import this swf into my main flash website using a loader and the sound will continuously play everytime the button is clicked in the parent. My question is how do I get the sound to completely clear itself and restart from frame 0 of the child swf upon every click of the button that loads the child into the loader within the parent.
var myLoader:Loader = new Loader();// create a new instance of the Loader class
var project1:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Greeting_Card/GreetingCard.swf");
[code].....
View 1 Replies
Mar 12, 2010
I have added two consecutive streaming audio tracks (mp3) to the timeline of a child SWF. The child SWF loads onto a parent SWF using a loader. After loading the child SWF the movieclip and audio plays without a problem. I have a problem with stopping the audio. After the child is unloaded and the playhead reset in the parent SWF the first audio track from the child SWF begins to play again (but not the one right after it). I have been trying to use the SoundMixer.stopAll(); command to stop the audio. I have not been successful in preventing the audio from playing. I now see that the command only works after the audio begins playing. Is there a better way to control streaming audio embedded in the timeline? I need to prevent it from playing again.
View 3 Replies
Jan 23, 2011
I'm using for my video player, it loads and plays fine and it stop playing music on the main template when loaded. I have actually two requests: First: How do I pause the video when the player is loaded ?
Second: When the player is unloaded from the main template using root.main_mc.close_btn the video still playing in the background and the close button (close_btn) pause and play the music player each time it is pressed and from the same position it was left last time.
View 1 Replies
Dec 27, 2011
There must be a simple solution to stop the sound and unload it in as3.
This is not all of my code, but in short I am loading random sounds. I need certian vars to be outside of the function so I can reference them with other functions for a progress bar.
How do I unload a sound so I can load a new one using the same names without getting an error the second time its called?
I have two buttons in this test. A play Sound and a Stop Sound Button.
here is my code:
var TheSound:Sound = new Sound();
var mySoundChannel:SoundChannel = new SoundChannel();
PlayButton.addEventListener(MouseEvent.CLICK, PlaySound);
[Code]......
View 1 Replies
Jun 16, 2010
I have a master swf that uses Loader to load in an external swf. I need to load a back button on top of that stack as a separate Child - and I have code in that loaded Child that needs to Unload the Loader-Loaded swf, unload the Buttons, and move the main timeline to another frame.
View 2 Replies
Oct 26, 2009
We have 4 buttons, each calls a different swf. Cannot get one swf to unload audio when another is called.Have tried many scripts but none work. Still hear audio of previous swf on top of newly-loaded swf. This was never a problem in AS2 but too late to go back to AS2, must resolve in AS3.I read that this is a bug but everything I have tried does not work. Have been using UILoader to get position accurate x=150, y=40.
For loading have tried List, UILoader, addChild, etc. Don't know which is best to use so it can be unloaded.
View 4 Replies
Jun 21, 2009
I've created an object (a person named jop) from a number of other symbols, and I've added the person to the stage manually (i.e. not via AS). One of the symbols, the mouth, has multiple frames, and I would like to stop it from playing at runtime. Here's what I tried:
[Code]...
What I don't understand is why flash sees the mouth as a DisplayObject and not a MovieClip, when I've definitely gone into its properties to make sure it was a MovieClip. It would make a nice shortcut if I were able to handle MovieClips this way, so I hope theres a way...otherwise I guess I'd have to add all the components of poor ol' jop to the stage at runtime to have access to them as movieclips.
View 2 Replies
Mar 22, 2012
I'm using some loopable tracks in a game I'm making and they are imported mp3 files in the .fla file. I export them for actionscript as different classes and then create them as variables, basic stuff.
[Code]...
View 1 Replies
Sep 3, 2010
So I am loading in external swfs and once loaded in I want to stop the main timeline. so I do the following.
var swf : MovieClip = e.target.content ;
swf.stop();
which doesn't work, because I have trace statements in the external swf which fire off after that command is called. Which, here is another weird thing, When I trace through the loaded swf, it says it has two children, a shape, and a Loader. The shape is weird because what I have is another movieclip on stage so I should get instaceXX, and I dont know where that Loader class is coming from.
which also brings me to another question which is everytime I add the swf to the stage it duplicates the instance, and I run out of memory really fast after I keep removing and re-adding it. all I call is.
targetMC.addChild(swf);
then after the swf dispatches an event saying its done.
targetMC.removeChild(swf);
View 1 Replies
Dec 16, 2011
I am embedding SWFs into Articulate Presenter for final publishing. Some of the SWFs have child movieclips with animations. How do I stop the child movieclip playhead when the parent timeline is paused from the Articulate controls? I'm thinking there must be an event listener for when the parent timeline stops, which could trigger the child movieclip to stop.
View 1 Replies
May 23, 2009
I'm using Adobe Flash CS4 on Mac (windows i'm sure i can figure out how to fix it on the mac version)I'm trying to sync some animation to sound, and my sound is all in one big file. I'm wanting to go through frame by frame and tweak it (Yes, it's a frame by frame animation, no tweening here don't ask why, it's just not), anyways, I keep trying to use the "Control -> Play" button to keep playing the sound from the area I'm working on so I don't have to start at the beginning everytime. After I hear the section I want, I want to just push "stop" and everything stop, including the audio. It would stop everything before, but now it's not stopping the audio so it will just keep playing even though I had hit stop.?
View 1 Replies
Apr 21, 2010
I am trying to get music to play continuously, it works, but everytime you click on a button, the song restarts on the new frame.The sound code is on frame 1, and is loaded from and external file.[code]...
View 17 Replies
Mar 14, 2012
just looking to stop one sound without stopping all sounds with a buton click
View 11 Replies
Jan 27, 2009
I have several swf files which are completed screencasts with voice overs, which I need to integrate into a flash application to distribute on CD to new students.
To play the screencasts in my flash file, I'm navigating to a new frame for each one which has a movie clip on it (instance name myscu3 for example). The myscu3 movieclip has about 20 frames of animation to grey out the screen behind, and then a couple of frames with actionscript on them, which 1) first frame shows a loading screen while the screencast swf is loading via a Loader and then navigates to the 2) second frame where the screencast coords are set and addChild is used to show the screencast via the Loader.
All works fine EXCEPT ... if I navigate away from the parent timeline frame where the myscu3 clip is ... the screencast disappears (as it should, as the myscu3 clip isn't on other frames, but if the screencast hasn't finished playing before I navigate away, the sound keeps playing.
how to stop the sound playing, as the loader is in the child movieclip, and the navigation away from the frame containing it is accomplished by clicking on any of the tabs at the side (on the main timeline). Any ideas? Is there actionscript code which will just stop any current sound playing (without stopping the ability to play sound) which I could add into the tabs navigation code?
View 1 Replies
Jan 30, 2009
I want to use a button to stop just 1 single sound. (Ill have a background track playing, and a voice over on top, and want a button to stop just the voice.) I was able to get an mc with 2 frames inside with 2 buttons and have this code:
on (release) {
tellTarget ("../sound") {
stopAllSounds();
}
}
on (release) {
nextFrame();
}
That will work but it stops all sounds. Can i stop just the "../sound" portion??
View 2 Replies
Apr 2, 2009
I am creating an e-learning to put into an LMS which has sound files. in order to play in the LMS, the sound file has to be in the timeline of the flash file, and not called through attachSound, or attachAudio. I would like to trigger an event after the end of the sound, so i have made a movie clip, placed the sound in the movie clip, and put the event at the end.whenever i advance, or back up in my file, the sound continues to play. i've tried stopping the sound by:[code]neither of those will stop the sound. The movie will advance, but the sound also continues to play. If I go back to the sound, it restarts, but I will need a way to stop it.
View 3 Replies
Jan 4, 2010
Is this possible? I've loaded an external swf into my movie - the swf stays on stage but loses focus throughout a users interaction.When it loses focus, I need the sounds within it to stop.It was mentioned that I should cast my swf as a movie clip but when I try I get errors.
View 4 Replies
Aug 5, 2009
how do we stop a streaming sound?
sound.stop();
or
sound.close();
View 1 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
Jun 13, 2010
I am using an addChild() method to place an intro MovieClip into a website. It has a short ten second musical track. I also have a skip intro button on the stage which does a removChild(). I keep trying to write code that will also stop the sound, which continues to play. I tried loading the sound separately and used the channel.stop(); So far nothing is working. It seems like I've been here before.
[Code].....
View 5 Replies
Feb 12, 2009
I am having a very difficult time stopping the sound when I mouse Out. I originally included the sound directly on the Mouse Over frame in Flash, but it wouldn't stop, so i removed that and wrote the following code:
var snd:sherrin = new sherrin();
var channel:SoundChannel = new SoundChannel();
var Symbol1:SimpleButton = new SimpleButton();
[code]....
I got this to where I get no Output or Compile errors, but the sound still doesn't play.
View 0 Replies
Aug 31, 2009
How can I control sound in flash so that:
1) the music starts when the user clicks on a play button but when they click on the play button again while the music is playing, the music DOESN'T overlap?
2) the music doesn't overlap when going back to the homepage where the music first started playing??
I'm currently using the code below but the music overlaps when I press the play button more than once while the music is playing and when I go back to the page where the music started playing...
Code:
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0; // pause button
mySound.load(new URLRequest("that_tune.mp3"));
[code]....
View 2 Replies
Mar 21, 2009
How can I stop a sound variable playing? Say I have sound playing on the first frame.
var nar1:Narration1 = new Narration1();
nar1.play(0,0);
I have a button and when it's clicked, I want "nar1" to stop playing, and a new sound to begin. I would imagine this works, but it doesn't:
var nar2:Narration2 = new Narration2();
nextbutton.addEventListener(MouseEvent.CLICK, playnar2);
function playnar2(e:MouseEvent):void{
nar1.stop(0,0);
nar2.play(0,0);
}
Instead, "nar1" keeps going and "nar2" just plays over it. I tried SoundMixer.stopALL, but that just stops all sounds and I don't want that.
View 1 Replies
Oct 19, 2003
In the tutorials, there is a sound loop that you start with a button, The fla didn't have a stop script to add to a second button.
View 4 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
Sep 22, 2009
In my website i have some videos. When i import the video.swf to my main swf. everything works fine. But if i navigate away from the video part the video goes away but the sound keeps playing.
I dont want to use the flash.media.SoundMixer.stopAll() function becasue i have a jukebox player that i want to work inbetween. and dotn want it to stop when you navigate the menu. It only stops when you go to Videos.
Here is the code i use:
var image:Loader = new Loader();
addChild(image);
image.x = 95;
[Code]......
What can i put in the news button to make the sound from the video stop.
View 7 Replies
Oct 2, 2007
I've set a music sound to play across three scenes in my movie. However, when the user clicks to enter the fourth scene, I'd like the music to stop. Simple enough.
Here's the problem...the fourth scene contains individual keyframes in the scene where I have separate voice overs for each frame. The user navs forward or backward among the scene's keyframes using arrow buttons for forward and backward. How can I have the voice over stop playing on frame 1 if the user clicks the arrow to go to frame 2 if the frame 1 sound isn't finished playing? Frame 1 plays out until finished, even if the user has clicked to go to frame 2.
Then, on return to the main scene where the general music file played, I'd like it to resume playing upon the user clicking 'return home.'
Incidentally, I set up my sound files to play on a soundtrack timeline.
View 4 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