Note that there are some explanatory texts on larger screens.

plurals
  1. POStopping the sound of a child swf
    text
    copied!<p>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.</p> <pre><code>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"); var project2:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Landscape/Landscape.swf"); var project3:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/SpaceInvadersTribute/Main.swf"); var project4:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/RandomImageProducer/RndImgProd.swf"); //var project5:URLRequest = new URLRequest("Projects/Q1/Flash_Projects/Tutorial/Main.swf"); var project6:URLRequest=new URLRequest("Projects/Q1/Flash_Projects/Soundboard/Main.swf"); btnQ1P1.addEventListener(MouseEvent.CLICK,Greeting); btnQ1P2.addEventListener(MouseEvent.CLICK,landscape); btnQ1P3.addEventListener(MouseEvent.CLICK, tribute); btnQ1P4.addEventListener(MouseEvent.CLICK, slideshow); //btnQ1P5.addEventListener(MouseEvent.CLICK, tutorial); btnQ1P6.addEventListener(MouseEvent.CLICK, soundboard); addChild(myLoader); function Greeting(event:MouseEvent):void { SoundMixer.stopAll(); myLoader.load(project1); myLoader.x=550; myLoader.y=130; } //Errors with Sound clips function landscape(event:MouseEvent):void { SoundMixer.stopAll(); myLoader.load(project2); myLoader.x=440; myLoader.y=130; } function tribute(event:MouseEvent):void { SoundMixer.stopAll(); myLoader.load(project3); myLoader.x=550; myLoader.y=170; } //Errors with slideshow Code! function slideshow(event:MouseEvent):void { SoundMixer.stopAll(); myLoader.load(project4); myLoader.x=530; myLoader.y=130; } //function tutorial(event:MouseEvent):void{ //SoundMixer.stopAll(); //myLoader.unload(); //myLoader.load(project5); //myLoader.x = 440; //myLoader.y = 130; //} function soundboard(event:MouseEvent):void { SoundMixer.stopAll(); myLoader.load(project6); myLoader.x=550; myLoader.y=130; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload