10 Replies Latest reply on Mar 4, 2009 10:40 AM by Joe ... Ward

    Open a ASP file from the server

      I want to open a .asp file in a cromeless window that I have on my server, what do I have to do to get it to work?
      Thanks for your help!
        • 1. Re: Open a ASP file from the server
          tzeng Adobe Employee
          You didn't tell how you normally access the file.
          I assume you use HTTP to access it. You can load it with HTMLloader.
          1 person found this helpful
          • 2. Re: Open a ASP file from the server
            Hi tzeng
            Ok, can you please help me getting it to work?

            I open a new window with:
            function anewWindow()
            {
            var options = new air.NativeWindowInitOptions();
            options.systemChrome = "none";
            options.type = "lightweight";
            options.transparent = "true";
            var windowBounds = new air.Rectangle(200,250,480,420);
            var newHTMLLoader = air.HTMLLoader.createRootWindow(
            true, options, true, windowBounds);
            newHTMLLoader.load(new air.URLRequest(" http://www.mydomain.se/air/video.asp?userId=6&id=6"));

            newHTMLLoader.window.opener = window;

            }

            But it only show the background that I have in the video.asp!
            The content from the database is not showed?

            Do I have to set up a bridge in some way? I guess so, but I dont know how?
            • 3. Re: Open a ASP file from the server
              Joe ... Ward Level 4
              You only need to set up a bridge to pass information between the application sandbox and another sandbox.

              What is in the page that's being returned? Is it just HTML + JavaScript?

              Also note that in this case, the statement:
              newHTMLLoader.window.opener = window;
              won't work. Since you are loading a remote page, the anewWindow() fucnction won't be able to access the newHTMLLoader.window property. Also, since loading a page is asynchronous, setting the opener immediately may not work -- you might have to wait for the page complete or load event (sorry if I overlooked that in an earlier reply).
              • 4. Open a ASP file from the server
                Hi Joe...Ward
                Its a flashvideoplayer that Im trying to get and some values from the database.
                Could you please show me an example on what the code should look like? Thanks!

                When I look at the video it works fine in the browser, but it does not show up in the air?
                • 5. Re: Open a ASP file from the server
                  tzeng Adobe Employee
                  You might hit the bug:
                  SWF content in HTML does not display properly for applications using transparent windows.:
                  http://www.adobe.com/support/documentation/en/air/1_5_1/releasenotes_developers.html#fixed _bugs

                  "options.transparent = "true"; "
                  Should set to false to avoid the bug.
                  • 6. Re: Open a ASP file from the server
                    Ok, thanks ! The video works fine if I use window.open.

                    But how can I get the following to work. Thanks!
                    function openVideoWindow()
                    {
                    var options = new air.NativeWindowInitOptions();
                    options.systemChrome = "none";
                    options.type = "lightweight";
                    options.transparent = "false";
                    var windowBounds = new air.Rectangle(200,250,480,420);
                    var newHTMLLoader = air.HTMLLoader.createRootWindow(
                    true, options, true, windowBounds);
                    newHTMLLoader.load(new air.URLRequest(" http://www.manmade.se/icongadgets/admin/video/video2.asp"));

                    newHTMLLoader.window.opener = window;

                    }
                    • 7. Re: Open a ASP file from the server
                      Joe ... Ward Level 4
                      Set options.transparent to the Boolean value: false (no quotes), not the string value: "false" (with quotes). Other than that, your function ran for me and played the video (I did run it from ActionScript, not HTML, though, but that should work the same).
                      1 person found this helpful
                      • 8. Re: Open a ASP file from the server
                        Thanks Joe...Ward
                        But with this code it is not working for me?
                        function openVideoWindow()
                        {
                        var options = new air.NativeWindowInitOptions();
                        options.systemChrome = "normal";
                        options.type = "lightweight";
                        options.transparent = false;
                        var windowBounds = new air.Rectangle(200,250,480,420);
                        var newHTMLLoader = air.HTMLLoader.createRootWindow(
                        true, options, true, windowBounds);
                        newHTMLLoader.load(new air.URLRequest(" http://www.manmade.se/icongadgets/admin/video/video2.asp"));

                        newHTMLLoader.window.opener = window;

                        }

                        and I open the function with:
                        <a href="#" class="video" onClick="openVideoWindow()" title="VIDEO" border="0">testing</a>

                        I never thougt that it would be so hard to open a window the way I want :-)
                        • 9. Open a ASP file from the server
                          Finally it works :-)
                          With options.systemChrome = "none"; it works better! My mistake!

                          So Joe...Ward thanks for your help, lets see if I get it right?

                          If I open a file thats in the application "read_video.html" from the code above (thats in index.html), and have a link to WindowControl.js from "read_video.html" then I will be able to move, close the window and I will have access to the system API!?
                          And in read_video.html I will have an iframe that loads the video2.asp from the server.
                          The iframe code that I have looks like this:

                          <iframe
                          id="iframen"
                          src=" http://www.manmade.se/icongadgets/admin/video/video2.asp"
                          sandboxRoot=" http://www.manmade.se/icongadgets/foo"
                          documentRoot=" http://www.manmade.se/icongadgets/admin/video/"
                          onDOMInitialize="setBridge()"
                          allowCrossDomaininXHR="true">

                          </iframe>
                          Is the iframe code correct?
                          Do I have to have the crome images for the read_video.html window in the application or can I have a background image in the video2.asp that I get from the server?
                          Thanks again!
                          • 10. Re: Open a ASP file from the server
                            Joe ... Ward Level 4
                            quote:

                            If I open a file thats in the application "read_video.html" from the code above (thats in index.html), and have a link to WindowControl.js from "read_video.html" then I will be able to move, close the window and I will have access to the system API!?

                            Correct.

                            quote:

                            And in read_video.html I will have an iframe that loads the video2.asp from the server.

                            Yes.

                            quote:

                            The iframe code that I have looks like this:
                            <iframe
                            id="iframen"
                            src=" http://www.manmade.se/icongadgets/admin/video/video2.asp"
                            sandboxRoot=" http://www.manmade.se/icongadgets/foo"
                            documentRoot=" http://www.manmade.se/icongadgets/admin/video/"
                            onDOMInitialize="setBridge()"
                            allowCrossDomaininXHR="true">
                            </iframe>
                            Is the iframe code correct?

                            I don't think you need to set the sandboxRoot or the documentRoot values for this. These are used to map a file from your application into a remote sandbox. (Also, as a general practice, don't set allowCrossDomainXHR true, unless you need to.)

                            quote:

                            Do I have to have the crome images for the read_video.html window in the application or can I have a background image in the video2.asp that I get from the server?

                            If you are using the images as mouse targets to trigger the window management functions, then they need to be in the read_video.html window so that the application sandbox code has access to the mouse events. The background could be from the remote page (assuming the layout works).
                            1 person found this helpful