Posted By

visualadvance on 08/04/09


Tagged

actionscript link 3 getURL as3 URLRequest navigateToURL


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

sultano
Pingpongbal
TrentSkunk
tspitzr
adrianparr


AS3: Link URL Manager


 / Published in: ActionScript 3
 

Super basic, but I use this all the time to make buttons execute external links.

  1. hitBox.addEventListener (MouseEvent.MOUSE_DOWN, linkDown);
  2. hitBox.xLink = "http://www.google.com"
  3.  
  4. private function linkDown (evt:MouseEvent):void
  5. {
  6. var url:String = evt.target.xLink;
  7. var req:URLRequest = new URLRequest (url);
  8.  
  9. try
  10. {
  11. navigateToURL (req, "_blank");
  12. } catch (evt:Error)
  13. {
  14. trace("Error occurred!");
  15. }
  16. }

Report this snippet  

You need to login to post a comment.