4 Replies Latest reply on Mar 9, 2009 11:58 PM by BBCLX

    Opening default Browser from embedded Flash

    BBCLX Level 1
      The Situation is this:

      I have a running flash application myapp.swf (Actionscript 2), which runs on a server and requires a parameter ( http://myserver.com/myapp.swf?myparam=value).

      I now want to create an AIR Wrapper for this application. So I embed the above URL in a html-based AIR Project using the embed tag. When I launch my new AIR Project the application is displayed, but when I click on a link within the flash application a new AIR window opens, displaying the respective Webpage.

      But it should instead open a new tab or window in the default Browser of the respective operating system.

      I have tried the following without success:
      - Attempt to create a flash-based AIR Application. The application did not work properly since the swf file is on a server and not within the AIR Appplication. If I download the swf-file and put it in this directory I can't pass it the required parameter
      - Trying to open a default Browser window like this: http://snipplr.com/view/4442/adobe-air-open-new-url-with-sandbox-bridge. I belive this only works with a flash-based AIR Application too

      The best solution for me would be, if I could solve the problem without having to alter the flash part. But, if neccessary changing the flash part would also be an option.

      I really would appreciate any comments / suggestions on this matter
        • 1. Re: Opening default Browser from embedded Flash
          combustion007 Level 1
          So lets get this straight, you now have the content embedded/loaded within a HTMLLOADER, right? And when the AIR APPLICATION is launched, you would want the links that are embedded within the HTMLLOADER to open up in a browser? Are you using:
          navigateToURL(new URLRequest(" http://" + url), "_blank");

          Perhaps this might help you out.
          http://rickmahn.com/2008/02/25/adobe-air-windows-vista/
          • 2. Opening default Browser from embedded Flash
            BBCLX Level 1
            I should probably add, that I am not a very experienced AIR Developer.

            quote:

            So lets get this straight, you now have the content embedded/loaded within a HTMLLOADER, right?


            Probably not... I have a Html based project. Meaning that I refer to an initial html file from my application.xml. In this html File I embed the mentioned flash application using the following line:
            < embed height="100%" width="100%" src=" http://myserver.com/myapp.swf?myparam=value" />

            Could I use HTMLLoader in a HTML-based AIR app?

            quote:

            And when the AIR APPLICATION is launched, you would want the links that are embedded within the HTMLLOADER to open up in a browser?

            This is correct, but it should open up the default Browser like IE or Firefox but not a new AIR window.

            quote:

            Are you using: navigateToURL(new URLRequest(" http://" + url), "_blank");

            I am not using navigateToURL since the flash application I am working with "does not know" that it is wrapped by an AIR application. Therefore, it opens new URLs the way it is normally done in a flash stand-alone application.
            As I see it AIR recognises that a link is being called and opens a new, AIR window instance.

            I have seen the article about Windows Vista before, but I would think that it is not directly related to my problem, since I do not have to problem whether links are being opened in, for example, Firefox or Internet Explorer but links are opened in a build-in AIR Window.

            I hope shed some light on the problem I am having...
            • 3. Re: Opening default Browser from embedded Flash
              Joe ... Ward Level 4
              BBCLX,

              You ARE using the HTMLLoader. When you create an HTML-based AIR app, the runtime creates a NativeWindow, adds an HTMLLoader to it (setting it up so that it fills the window), and loads your HTML content into the HTMLLoader.

              To get links to open in the user's default browser, you must set the HTMLLoader object navigateInSystemBrowser property to true. Do this in the main HTML page with:

              window.htmlLoader.navigateInSystemBrowser = true;
              • 4. Re: Opening default Browser from embedded Flash
                BBCLX Level 1
                This works perfect. Thanks very much.