Flash Continues To Play When Hidden. How Can I Stop It?

Question: My Flash continues to play even while hidden from view; how can I stop it?

Answer: Remove the Flash object from the page with javascript.
An easy way to pull this off is by using  jQuery’s remove function.
$('object').remove();

First, include jquery in the head section of your HTML.

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

In the HTML code for your Flash file, assign an id attribute to the object tag.
<object id="myFlash">

If you don’t use the object tag then add the id attribute to the embed tag instead.

Once you have assigned your Flash an id attribute you can use the id in the jQuery code as the selector. Call the remove function whenever you want to remove the Flash from the page.
For example, here is how you could code a link which would remove the Flash object with the id myFlash.
<script type="text/javascript">

function removeFlash(id){
jQuery('#' + id).remove();
}

</script>

<a href="javascript:void(0);" onclick="removeFlash('myFlash');">Remove The Flash</a>