JOHN T.
JOHN T.

Reputation: 1

Converting an Actionscript 2 Script to an AS3 Equivalent

I have the following code to open a document through a separate window (through a button action) in AS2:

mapSym_btn.onRelease = function() {
getURL ("https://myPortal.html", "_blank")}

Can anyone show me how to get the same results in AS3? I'd appreciate any assistance.

Upvotes: 0

Views: 155

Answers (1)

ToddBFisher
ToddBFisher

Reputation: 11610

(untested code)

mapSym_btn.addEventListener(MouseEvent.CLICK, goSomewhere);
function goSomewhere(evt:MouseEvent):void {
   var request:URLRequest = new URLRequest("https://myPortal.html");
   try{        
      navigateToURL(request, "_blank")
   } catch(e:Error){
      trace("Ah snap, there was a problem!");
   }
}

Upvotes: 2

Related Questions