Posted By

dareng on 02/22/11


Tagged

as3


Versions (?)

as3 getUrl


 / Published in: ActionScript
 

  1. my_btn.addEventListener(MouseEvent.CLICK, myBtnClicked);
  2.  
  3. function myBtnClicked(e:MouseEvent):void {
  4. var url:String = "http://www.example.com/";
  5. var request:URLRequest = new URLRequest(url);
  6. try {
  7. navigateToURL(request, '_blank');
  8. } catch (e:Error) {
  9. trace("Error occurred!");
  10. }
  11. }
  12.  
  13. // Lazy shorthand. Reminder: navigateToURL SHOULD be in a try/catch
  14. my_btn.addEventListener(MouseEvent.CLICK, myBtnClicked);
  15.  
  16. function myBtnClicked(e:MouseEvent):void {
  17. navigateToURL(new URLRequest("http://www.example.com/"));
  18. }
  19.  

Report this snippet  

You need to login to post a comment.