AS3 button link

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

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.

Copy this code and paste it in your HTML
  1. btnname.addEventListener(MouseEvent.CLICK, myBtnClicked);
  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


RSS Icon Subscribe to comments

You need to login to post a comment.