0

I'm trying to create a button which will close a flash overlay using javascript and actionscript. I have found on many websites to use ExternalInterface however I cannot seem to get it to work. Any ideas?

Flash AS:

import flash.external.ExternalInterface;

close_btn.addEventListener(MouseEvent.CLICK, clickHandlerButton);

function clickHandlerButton(e:MouseEvent):void{
        if(ExternalInterface.available) ExternalInterface.call("hideBanner","");
}

Javascript Function:

<script>
    function hideBanner(){
        document.getElementById("banner").style.display = "none";
    }
</script>

If I add a trace to the MouseEvent then I can confirm that ExternalInterface.available returns true.

Stefan Dunn
  • 5,363
  • 7
  • 48
  • 84

2 Answers2

2

Once I uploaded this to my server it worked but not by opening the html file from my computer into Google Chrome.

Stefan Dunn
  • 5,363
  • 7
  • 48
  • 84
1

For local access to ExternalInterface you have to add the swf path to the Flash trusted paths, here is guide for it.

fsbmain
  • 5,267
  • 2
  • 16
  • 23