4 Replies Latest reply on Aug 19, 2006 3:53 AM by dafl00

    Simple Application Doesn't Load from Web Server

    dafl00
      Hello

      I'm evaluating the Flex 2 SDK and Flex Builder and I've seen a problem while trying access an swf file through my web server. It simply does not show, but loading the SWF or HTML file from a local directory displays the page just fine.

      The code can be as simple as:
      [code]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">

      <mx:Label text="falalalalallalalalalla" id="poemBox" width="100%" />

      </mx:Application>
      [/code]

      I've uninstalled and installed flex builder and the sdk already, but nothing changes.
        • 1. Re: Simple Application Doesn't Load from Web Server
          peterent Level 2
          If you are using Flex Builder 2, your project has a bin directory. Copy all of the files in that directory to your web server. Now you don't need all of the files, but it is easier to copy them all and delete the ones you don't want (such as the debug ones).

          Suppose your web server is using port 80 and, in its web root, you make the directory "myapp". Copy the bin files into the myapp directory. If the HTML file in the bin directory is called "MyProject.html" then you can run the application:

          http://mywebserverhost/myapp/MyProject.html
          • 2. Re: Simple Application Doesn't Load from Web Server
            dafl00 Level 1
            quote:

            Originally posted by: peterent
            If you are using Flex Builder 2, your project has a bin directory. Copy all of the files in that directory to your web server. Now you don't need all of the files, but it is easier to copy them all and delete the ones you don't want (such as the debug ones).

            Suppose your web server is using port 80 and, in its web root, you make the directory "myapp". Copy the bin files into the myapp directory. If the HTML file in the bin directory is called "MyProject.html" then you can run the application:

            http://mywebserverhost/myapp/MyProject.html


            Right, well that's what I've been doing. Everything in that bin folder can be moved anywhere else in my hard drive and double-clicking the HTML or SWF file shows the application perfectly. But after moving all the files in bin to my webserver and accessing the HTML file through my browser from the URL, all that shows up is a colored background.

            Right-clicking on the browser shows 3 un-enabled items: "Movie not loaded...", "Show redraw region", and "debugger".

            At first, I figured it was a security setting that I had to enable. But the only documentation about security settings that I found involved using JRun.

            In fact, I can view the the flex application through a URL from the JRun server in the Data Services application, but it is too inefficient to have JRun running and Apache running at the same time since I wanted to try out the web services feature with PHP and Flex.

            Here's a picture of what I see in my browser.
            • 3. Re: Simple Application Doesn't Load from Web Server
              dafl00 Level 1
              One further note: interestingly enough, if I upload all the files into a site like geocities, it works fine. I suppose Apache HTTPD needs some configuration to serve Flex SWF files. I'll keep fishing for an answer and post it here if I find it (unless someone else beats me to it).
              • 4. Re: Simple Application Doesn't Load from Web Server
                dafl00 Level 1
                So I created a little PHP script to help myself figure out what's going on:
                <?php
                header("Cache-Control: no-cache");
                header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                header("Content-Type: application/x-shockwave-flash");

                print(file_get_contents("C:\\path\\to\\flex.swf"));

                ?>
                With this, I got a different menu when I right-clicked on the browser. There was an option for "Play" in this context menu and clicking it showed the application perfectly.
                Here's the new context menu

                Now I just wonder what it all means