Reputation: 1489
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
Upvotes: 1
Views: 6141
Reputation: 1
I tried lot of things e.g. $("object").stop();
nothing worked for IE.
Then I came up with this dirty solution. I put this whole object inside a div
then in javascript
document.getElementById("outerdiv").innerHTML="";
boom ... works like a charm...
Upvotes: -1
Reputation: 1489
function test() {
movie = document.getElementById('FlashControl1');
movie.stopSound();}
this worked :)
Upvotes: 0
Reputation: 5478
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.
Upvotes: 2