PDA

View Full Version : Open link in new browser window



small_guy
November 27th, 2008, 09:00 AM
I am just starting out with AS 3.0 (after having worked with Flash and AS 2.0 for a number of years).

I picked up this code from another source to open a new URL

button.addEventListener(MouseEvent.CLICK, buttonClickHandler);

function buttonClickHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.kirupa.com");
}

This much all works fine. But my question is: how to open the new URL in its own browser window. In AS 2.0 it was just adding the "_blank" part after the URL address. But that does not work here.

If someone could enlighten me on how this works with AS 3 it would be appreciated. Thanks.

Iamthejuggler
November 27th, 2008, 09:22 AM
navigateToURL(new URLRequest("http://www.kirupa.com"), "_blank");

edit: The code you posted shouldn't have worked as the new URLRequest line needs another closing bracket, one for the URLRequest, and one for the navigateToUrl.

small_guy
November 27th, 2008, 02:19 PM
Thank you.


navigateToURL(new URLRequest("http://www.kirupa.com"), "_blank");

edit: The code you posted shouldn't have worked as the new URLRequest line needs another closing bracket, one for the URLRequest, and one for the navigateToUrl.