AS3 Javascript Popup


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

HtmlPageUtils.viewPopup("http://www.google.ca", "mypopup");


Copy this code and paste it in your HTML
  1. package
  2. {
  3. import flash.external.ExternalInterface;
  4. import flash.net.URLRequest;
  5. import flash.net.navigateToURL;
  6.  
  7. public class HtmlPageUtils
  8. {
  9.  
  10. public static function viewPopup(_address:String, _wname:String = "popup", _width:int = 400, _height:int = 400, _toolbar:String = "no", _scrollbar:String = "no", _resizeable:String = "yes"):void {
  11. var address:String = _address;
  12. var wname:String = _wname;
  13. var w:int = _width;
  14. var h:int = _height;
  15. var t:String = _toolbar;
  16. var s:String = _scrollbar;
  17. var r:String = _resizeable;
  18.  
  19. if (ExternalInterface.available) {
  20. ExternalInterface.call("window.open", address, wname, "height=" + h + ",width=" + w + ",toolbar=" + t + ",scrollbars=" + s + ",resizable=" + r + "");
  21. }else {
  22. var jscommand:String = "window.open('" + address + "','" + wname + "','height=" + h + ",width=" + w + ",toolbar=" + t + ",scrollbars=" + s + ",resizable=" + r + "');";
  23. var url:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
  24. try{
  25. navigateToURL(url,"_self");
  26. } catch (e:Error) {
  27. trace("Popup failed", e.message);
  28. }
  29. }
  30. }
  31.  
  32. }
  33. }

URL: http://www.chrisbaigorri.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.