Implementing javascript into flash

I have this javascript piece that on windows opens an .exe file and on mac opens flash version.
I only know how to include a javascript piece that opens a new window in flash.
If anyone can help on this i would appreciate that :slight_smile:
Here’s the code:


function link() {
       if(navigator.userAgent.indexOf('Mac') != -1)
        		{
			window.open('FLASHVERSION','newWin','width=800,height=600,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus(); void(0);
            }
        else
			{
			open('EXEFILE');
          	}
}

You can call JavaScript from Flash.

What I would do is have the JavaScript on your page, then call link() from your SWF.

You call JavaScript using ExternalInterface.

I’ve written an article about it which might help you get started: http://fcOnTheWeb.com/articles/javascript_with_actionscript/

Good luck!

I just tried it out with the as3 method and it works, thanks :slight_smile: