Posted By

cbaigorri on 04/15/09


Tagged

popup as3 actionscript3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

tspitzr
ballen205


AS3 Javascript Popup


 / Published in: ActionScript 3
 

URL: http://www.chrisbaigorri.com

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

  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. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ShibliZaman on October 7, 2009

Hi,

I am new in flash. I am just wondering if it is possible to give me the fla file for this. I would like to see how it's structure. I would appreciate if you could do that for me.

Thanks Shibli Zaman

Posted By: viaria on September 8, 2010

yes it could be nice to give an example, like instanceName.viewPopup(params)

You need to login to post a comment.