3 Replies Latest reply on Jan 2, 2007 1:18 PM by kglad

    Flash and JavaScript

    derspinne Level 1
      Hi everyone !!!

      I've a small question to make for the Flash experts, and is concerning a JavaScript function that I put into an HTML file. This function has the intention of opening a new different browser window apart from the page I supose to called it. The object of this is because I like to make a Downloads link into my Flash School Project. So, when I press a button from my .SWF File I want to see a new HTML browser window with an Image and save this to my Hard Disk. But the result I obtain is only open this link into the same window of the Master file, when I press back the Master file start to reload it self. I'm using Flash 8 Pro.

      Declaration.
      function Popup(URL,Name,features){
      window.open(URL,Name,features);
      }

      This is my JavaScript function

      function wallpaper(n,v){
      var xMax = screen.width;
      var yMax = screen.height;
      var xOffset = (v==1)?(xMax - 1024)/2 : (xMax - 800)/2;
      var yOffset = (v==1)?(yMax - 768)/2 : (yMax - 600)/2;
      var x = (v==1)?1030:850;
      var y = (v==1)?780:650;
      var src = "wallpapers/wp"+n+"-"+v+'.jpg';

      var newWindow1=window.open(src,'Wallpaper','height='+y+',width='+x+',menubar=0,resizeable=0,s crollbars=0,status=0,titlebar=0,toolbar=0,left='+xOffset+',top='+yOffset+'');

      }


      And this is the way I'm trying to call from Flash. The firs one does'nt open nothing but thats the way the tutorial said.

      on (release)
      {
      getURL("javascript:wallpaper(1,2)");
      }

      I Also tried this method and the result is just open the image in the same page the Master SWF is, but doesn't open a new browser window. Probably I did not include something in the Publising settings, but I want an opinion.

      on (release)
      {
      fscommand("openWindow");
      filePath = "file://c:/portfolio/fla/wallpapers/wp1-1.jpg";
      getURL(filePath);
      }

      So. I would be wonder if someone can give me an opinion with this issue.
      Tks for the time to read this Post.