navigateToURL for banners


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

Переход по ссылке. Ссылка берется извне.


Copy this code and paste it in your HTML
  1. link_btn.addEventListener(MouseEvent.CLICK, callLink);
  2.  
  3. function callLink(e:MouseEvent):void {
  4. var url:String = LoaderInfo(this.root.loaderInfo).parameters['url'];
  5. //var url:String = root.url;
  6. var urlRequest:URLRequest = new URLRequest(url);
  7. navigateToURL(urlRequest);
  8. }
  9.  
  10.  
  11. //Opening a new window:
  12. navigateToURL (new URLRequest ("http://blog.activetofocus.com"), "_blank");
  13. //Sending an email:
  14. navigateToURL (new URLRequest ("mailto: [email protected]"));
  15. //Interacting with JavaScript:
  16. navigateToURL (new URLRequest ("javascript: window.close ()"));
  17. //Calling a JavaScript function:
  18. navigateToURL (new URLRequest ("javascript: MyJsFun (par. ..)"));
  19.  
  20.  
  21. //
  22. // Lazy shorthand. Reminder: navigateToURL SHOULD be in a try/catch
  23. my_btn.addEventListener(MouseEvent.CLICK, myBtnClicked);
  24.  
  25. function myBtnClicked(e:MouseEvent):void {
  26. navigateToURL(new URLRequest("http://www.example.com/"));
  27. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.