4 Replies Latest reply on Jul 20, 2008 10:25 PM by anirudhs

    Browser Window

    DARTHCYL0N Level 1
      I need to launch a JS popup from within Flex using the AIR browser (Basically I want to launch a defailt browser popup ).

      I have seen some answers , none of which makes sense, anyone have a working flex 3 example or sample for this I would love to take a look at it .
        • 1. Re: Browser Window
          anirudhs Level 2
          Hi,

          I'm assuming you are developing a Flex AIR application which has an mx:HTML control in it. Now from within the html page, you need to popup another HTML browser window.

          Have you tried implementing your own custom HTMLHost as described in http://livedocs.adobe.com/flex/3/html/help.html?content=ScriptingHTMLContainer_7.html?

          Simple create an actionscript class that derives from HTMLHost, override its createWindow() function and perform a new HTMLLoader.createRootWindow() in that.

          • 2. Re: Browser Window
            DARTHCYL0N Level 1
            What I am trying to accomplish I thought was simple but the more I look into it I am finding that it is not.

            prior to 1.1 when I used navigateToURL(); I would automatically open up the default browser and there were ways to launch pop ups from within flex/AIR applications

            I am looking for a simple sample code that does this (launch a default browser popup when a button is clicked.)
            • 3. Browser Window
              DARTHCYL0N Level 1
              I have stripped down the code,

              if I launch this from a browser , it works perfectly , however if I launch it from an html iframe within AIR , it opens a new air window. I need to have it open an IE window or default browser window due to active x content in the page.

              here is the basic code that works in a browser but not in an air app called through a sandbox iframe

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
              <mx:Script>
              <![CDATA[
              // function below opens window without getting it blocked
              private function openNewWindow(event:MouseEvent, url:String, winName:String, w:int, h:int, toolbar:int, location:int, directories:int, status:int, menubar:int, scrollbars:int, resizable:int):void {

              var fullURL:String = "javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);";
              var u:URLRequest = new URLRequest(fullURL);
              navigateToURL(u,"_self");

              }
              ]]>
              </mx:Script>
              <mx:Button click="openNewWindow(event, ' http://www.adobe.com/', 'candiespop', 800, 600, 0, 0, 0, 0, 0, 0, 0);" id="test" useHandCursor="true" buttonMode="true" mouseChildren="false" x="168" y="104.85" label="Open Window"/>
              </mx:Application>

              anyone know how to activate the default browser use, , feel free to edit this code and repost


              is there code I have to place in the iframe ?

              Ray
              • 4. Re: Browser Window
                anirudhs Level 2
                Hi,

                HTMLLoader has a property called navigateInSystemBrowser. Set that to true for all URL changes from an AIR HTML control to redirect to default browser.

                More info here: http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=9243&produ ctId=2&loc=en_US