Easily Target a URL with the Window Method of Your Choice


/ Published in: ActionScript 3
Save to your folder(s)

Great little snippet I use to target an external link.


Copy this code and paste it in your HTML
  1. // gotoLink takes 3 parameters: the event, the URL string, and the method (_self, _blank, etc)
  2. //
  3. // sample usage:
  4. // gotoLink( evt, "http://google.com", "_blank" );
  5.  
  6.  
  7. function gotoLink( evt:Event, l:String, meth:String ) : void
  8. {
  9. var URLReq:URLRequest = new URLRequest(l);
  10. try
  11. {
  12. navigateToURL(URLReq, meth);
  13. } catch (e:Error)
  14. {
  15. trace(e);
  16. }
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.