user1410668
user1410668

Reputation: 245

Stopping/muting audio

How would I be able to pause the following audio object when a link with the class "iFrame" is clicked?

<object type="application/x-shockwave-flash" data="../flash/player_mp3_maxi.swf" width="140" height="20">
<param name="wmode" value="transparent">
<param name="movie" value="../flash/player_mp3_maxi.swf">
<param name="FlashVars" value="configxml=../flash/config.xml&amp;mp3=../audio/intro/intro_08_background_07.mp3">
<p>Flash Audio Player</p>
</object>

I need to write the code in javascript or jquery.

Upvotes: 1

Views: 475

Answers (1)

Oskar Eriksson
Oskar Eriksson

Reputation: 2641

Provided it's your own .swf and that you can recompile it, I'd say you need to expose the players pause method using ExternalInterface. If you haven't done it before, have a look at http://livedocs.adobe.com/flex/3/html/help.html?content=19_External_Interface_04.html

Once you've done that you just add an event listener to the HTML link and assign a function to be triggered when the user clicks. This function calls the exposed flash function to pause.

theLink.addEventListener("click", function(e){
    //call the exposed flash pause function
    swfObject.theExposedFunction();
});

Makes sense?

Upvotes: 2

Related Questions