tags:

views:

1547

answers:

6

Hi,

I have a swf file that's embedded in a html page, and I have a close button in the swf page, I want the swf to disappear when I click on the button, what is the best way to do that? Thanks.

+1  A: 

Write a JavaScript function that will hide the swf or its containing element, and call that function via the "close button" in the swf itself.

Steve Paulo
+1  A: 

Heres an article on how to get flash to call some JS on your page. If you never want it back (after hiding) i suggest you remove it from the DOM to release resources, as flash is expensive in client environments.

Andrew Bullock
Removing an html snippet that holds the swf stops the flash player plug-in?
Jonathan Barbero
+1  A: 

I have done this with js, and to my horror, ie6 and ie7 just restart all sounds playing and keep them even when the whole html for the swf is gone (<object>, <embed>, <params> and event the <script> tags for the runner).

FireFox and Chrome perform as expected. Any ideas on how to prevent this behaviour?

I don't have time or interest to try this now, but that's horrifying. +1!
Yar
A: 

How i can disable link in swf i dont hve fla file.

+1  A: 

If your ursing swfobject 2.1 to embed the swf you can use this built-in javascript swfobject.removeSWF() function:

function removeFlashFromHTML() 
{
 swfobject.removeSWF("id_of_your_html_object");
}

now you call the javascript function from flash using ExternalInterface:

function buttonClicked(evt:MouseEvent) 
{
 if (ExternalInterface.available) {
  ExternalInterface.call("removeFlashFromHTML()");
 }
}

for more information about SWFObject check this website

yens resmann
A: 

yens resmann could you elaborate on your answer? I'm also trying to solve this same problem.

cody