How can I delete a SWF file embedded in html using a button in swf?
I have a swf file that is embedded in a html page and I have a close button on the swf page, I want the swf to disappear when I click the button, what is the best way to do this? Thank.
If your wursing swfobject is 2.1 to embed swf, you can use this built-in javascript swfobject.removeSWF () function:
function removeFlashFromHTML()
{
swfobject.removeSWF("id_of_your_html_object");
}
now you are calling javascript function from flash using ExternalInterface:
function buttonClicked(evt:MouseEvent)
{
if (ExternalInterface.available) {
ExternalInterface.call("removeFlashFromHTML()");
}
}
for more information on checking SWFObject this website
Write a JavaScript function that will hide the swf or its containing element and call this function through the close button in the swf itself.
Heres an article on how to get flash to trigger some JS on your page. If you never want it (after hiding), I suggest you remove it from the DOM to free up resources, as a flash drive is expensive in client environments.