Posted By

ddegner on 02/28/09


Tagged

url link addeventlistener navigateToURL


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

dfriedberg
marsman
tspitzr


AS3 button link


 / Published in: ActionScript 3
 

I just want a simple link, but it takes 8 lines of code?!

I like control but they could have made a shortcut of some sort for buttons.

  1. btnname.addEventListener(MouseEvent.CLICK, myBtnClicked);
  2.  
  3. function myBtnClicked(e:MouseEvent):void {
  4. try {
  5. navigateToURL(new URLRequest("/index.php"), "_self");
  6. } catch (e:Error) {
  7. trace("Error occurred!");
  8. }
  9. }

Report this snippet  

You need to login to post a comment.