/ Published in: ActionScript
Expand |
Embed | Plain Text
my_btn.addEventListener(MouseEvent.CLICK, myBtnClicked); function myBtnClicked(e:MouseEvent):void { var url:String = "http://www.example.com/"; var request:URLRequest = new URLRequest(url); try { navigateToURL(request, '_blank'); } catch (e:Error) { trace("Error occurred!"); } } // Lazy shorthand. Reminder: navigateToURL SHOULD be in a try/catch my_btn.addEventListener(MouseEvent.CLICK, myBtnClicked); function myBtnClicked(e:MouseEvent):void { navigateToURL(new URLRequest("http://www.example.com/")); }
You need to login to post a comment.
