I am attempting to stop the music inside of my flash swf that I have loaded in the page
<object id="FlashControl1" type="application/x-shockwave-flash"
data="Flash/Preloader%20-%20Splash.swf" width="980px" height="316px">
<param name="movie" value="Flash/Preloader%20-%20Splash.swf" />
<param name="wmode" value="Transparent" />
<param name="quality" value="High" />
<param name="play" value="True" />
<param name="loop" value="False" />
<param name="menu" value="False" />
<param name="scale" value="Exactfit" />
<param name="flashvars" value="name="FlashControl1"" />
<img src="Images/Banner/Main_Banner.jpg" alt="" width="980px" height="316px" />
</object>
I have a button that loads a modal popup with a silverlight video and I would like the audio to stop by execuding the SoundMixer.stop(); command.
I have yet to find a solution on google
From stackoverflow
-
In your Flash file, you must have the following function:
function stopSound():void { SoundMixer.stop(); }Then, you must make it available for JavaScript calls
ExternalInterface.addCallback('stopSound', stopSound);In your JavaScript code you must have this simple function that selects your swf:
function getFlashMovie(movieName) { var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[movieName] : document[movieName]; }And when you want to stop the sounds in your movie, you just call the function you've previously made available in the swf, from JavaScript:
movie = getFlashMovie('your-movie-name'); movie.stopSound();That should do it. For more info on ExternalInterface.addCallback, check out the Adobe AS3 Language Refrence page.
Mitchell Skurnik : Message: 'undefined' is null or not an object I am using the following to generate my flash fileMitchell Skurnik : function test() { movie = document.getElementById('FlashControl1'); movie.stopSound(); } ended up working. thank youevilpenguin : You're welcome. :) -
function test() { movie = document.getElementById('FlashControl1'); movie.stopSound();}this worked :)
evilpenguin : Make sure you check it on all browsers. I remember I had some problems with getElementById, but I don't remember exactly why I didn't use it in the end.
0 comments:
Post a Comment