Nicolas Guillaume
Nicolas Guillaume

Reputation: 8434

How to proprely remove a flash object from a HTML page

I made a website using AJAX (with jquery) for the navigation. The pages of the site are sliding and I use remove() to destroy the old page.

Every thing seems alright, but some times the browser crashes when he tries to remove the old page containing a Flash object.

I suppose this is because Flash is still executing the Flash object.

My question is simple.

How do i remove this Flash's object for my page without having the browser crashing on my face ? Is there a way to stop the Flash execution before removing the object ?

Thanks for your help.

Upvotes: 0

Views: 4064

Answers (2)

Nicolas Guillaume
Nicolas Guillaume

Reputation: 8434

At the end I've decided to use the swf object helper to do the job:

$('.flash_content').each(function ()
{
    swfobject.removeSWF($(this).attr('id'));
});

Upvotes: 2

JBRWilkinson
JBRWilkinson

Reputation: 4865

You need to get a reference to the Flash object, let's say it has an HTML ID of 'swf' and you need to stop it doing anything before you kill it:

swf.stop();

The alternative to this is to make the Flash object load some other movie that does 'nothing':

swf.movie = "http://www.domain-does-not-exist.com/donothing.swf";

Upvotes: 0

Related Questions