I handle this by having a js function in my wrapper create the new
window, with the parameters I need, then using externalInterface to
invoke the js function.

This has an additional benefit of allowing me to make the same window
show different content from flex(I haven't figured out how to do this
with navigateToURL directly).  Here is the javascript I am using:

Tracy

var windowHelp;
  function showHelp(sURL)
  {
    if (windowHelp && windowHelp.open && !windowHelp.closed)  {    //Be
SURE the window is available
      if (sURL != sLastURL && sURL.length > 0)  {                  //If
user wants a new url
        windowHelp.location.href = sURL;
//navigate
        sLastURL = sURL;
      }
      windowHelp.focus();
//always focus
    }
    else  {
      if (sURL.length > 0)  {
//make sure we have an url
        var iBorderWidth = 50;
        var iLeft = window.screenLeft;
        var iTop = window.screenTop;
        var iWidth = document.body.offsetWidth;
        var iHeight = document.body.offsetHeight;   
        
        var sWindowProperties =
"location=no,toolbar=no,scrollbars=yes,menubar=no,resizable=yes"
        sWindowProperties += ",top=" + (iTop + iBorderWidth);
        sWindowProperties += ",left=" + (iLeft + iBorderWidth);
        sWindowProperties += ",height=500";
        sWindowProperties += ",width=400";
        windowHelp = window.open(sURL,'Help',sWindowProperties);
        sLastURL = sURL;
      }
    }
  }//showHelp


From: [email protected] [mailto:[email protected]] On
Behalf Of simonjpalmer
Sent: Tuesday, December 30, 2008 10:11 AM
To: [email protected]
Subject: [flexcoders] Controlling browser window state during
navigateToURL

Hi,

I want to place a link on my app which starts a static HTML help page
in a new broswer window and I want to control the appearance of the
browser window that gets created. If I were doing this in HTML I
would use JavaScript window.open and set the config parameter, e.g.

<SCRIPT LANGUAGE="javascript">
<!--
window.open ('titlepage.html', 'newwindow', config='height=100,
width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no')
-->
</SCRIPT>

Is there a way of doing this in Flex (specifically Flex 2)?

TIA
Simon
 

Reply via email to