Search code examples
actionscript-3flashflash-cs4

Open .swf file in new window from other swf


I have a button in a swf file. I would like that when the button is pressed a swf loads in another window (want to call a new swf in new window.).

I was trying something like:

MYBUTTON.addEventListener( MouseEvent.CLICK, MYBUTTON_link );

function MYBUTTON_link(e:MouseEvent):void
{

    var urlRequest:URLRequest = new URLRequest("external.swf");
    loader.load(urlRequest);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadDone);

}

other way was

   fscommand ("exec", "external.swf");

but none of them works...


Solution

  • Try using navigateToURL instead:

    function MYBUTTON_link(e:MouseEvent):void
    {
        navigateToURL(new URLRequest("external.swf"), "_blank");
    }