8 Replies Latest reply on Mar 20, 2008 12:02 PM by EvolvedDSM

    Need help setting up Flex on server (sdk?)

    EvolvedDSM Level 2
      This should be a simple noob question:
      I have Flex Builder on my local machine. I've created an application (project.mxml) that uses VideoDisplay to play some videos chosen from a List using an XML file as the data source. The app works great testing on my local machine.

      I now wish to take my project and put it on my Windows 2k3 server.
      I copied over my project directory to the server at D:\Flex\ProjectName, and I set a website in IIS using home directory D:\Flex.

      At this point, I go to my local machine and punch in the URL, http://10.xxx.xxx.xxx:8700/ProjectName/bin/project.html, which brings up my application UI. I can see the app, it looks identical to my local machine. However, when I go to select my video from the List, nothing plays. I've included a function that checks for connection and it doesn't report back with an alert.

      As for the server, it has the newest version of Flash player (not sure if this is even needed on server side?) and it also has the Flex Data Services 2 installed (yes, I'm using Flex 2). I don't even think I need the FDS2 installed at the moment since I'm not really connecting to any data sources other than this xml file, but I installed it as a precaution since i have it installed on my local machine. This is as far as the server is setup for Flex. I've looked at documentation and its not clear to me as to what needs to be on the server to get Flex apps to work. Do I need to install Flex Builder on the server? Or the SDK? And what files am I supposed to give the server from my local machine? I've spent a great deal of time on this to see it fail on the server, so any help is appreciated.
        • 1. Re: Need help setting up Flex on server (sdk?)
          SujitG Level 2
          Hi,
          You need not copy the entire project folder into the web server. All you need to copy is the content from the output folder. If you use project->export release build in the flex builder, you can specify the folder into which you want the release version to be copied/compiled into. You have to copy the content from the release folder into the web server.
          basically you need to copy the SWF and the HTML wrapper of the SWF on to the web server.

          You don't need to install anything on the web server to host your Flex applications. Only your clients accessing the Flex application should have the Flash player installed for their browsers.

          Coming to the accessing XML part. How are you accessing the XML file from your Flex application? Are you using HTTPService to access the XML file or are you compiling the XML file with your Flex application?
          If you are accessing the XML file using the HTTPService, please make sure the URL to the XML file is correct.
          If you are compiling the XML file with your flex application i.e. including the XML file in the SWF file, then the path to the XML file should be relative to the projects main folder (src folder).

          Hope this helps.
          • 2. Need help setting up Flex on server (sdk?)
            EvolvedDSM Level 2
            Regarding my XML...
            I have a directory called vids within my project directory which both my FLV videos and the xml file are located.
            The structure is
            <videos>
            <lesson>
            <title>title</title>
            <url>vids/video_name.flv</url>
            </lesson
            </videos>
            I have 9 <lesson> tags that all contain a title and url

            I call it using an HTTPService
            <mx:HTTPService id="srv" url="vids/lessonVids.xml"/>

            In the app, I have an mx:List control that is populated with the titles of all the videos,
            <mx:List id="vidList" dataProvider="{srv.lastResult.videos.lesson}" labelField="title"/>

            I then use a VideoDisplay control to show the selected video from the List
            <mx:VideoDisplay source="{vidList.selectedItem.url}"/>

            It works perfect on my local copy, but when I export the site to my server and click on an item from the List, nothing happens. I found a nifty piece of code that reports back an alert if the app is unable to connect to the video, and I do get an alert now that says it's not connecting.
            Any idea of why it's acting this way on the server, but not on the local?
            • 3. Re: Need help setting up Flex on server (sdk?)
              macnimation2 Level 1
              Hi,

              Make sure your Windows 2003 server can run .flv files:

              1. Open the site to configure in IIS. Right click and select “Properties”
              2. Click the HTTP Headers Tab, select “File Types” under the MIME Map section, and then click “New Type”. Enter the following:
              * Associated Extension box: .flv
              * MIME Type box: flv-application/octet-stream
              3. Click “OK” and close the IIS Properties box
              4. You may need to restart the WWW Publishing Service


              Not sure if this is the issue but this needs to be done anyway.

              hope this helps.
              • 4. Need help setting up Flex on server (sdk?)
                EvolvedDSM Level 2
                I've added FLV to the MIME extensions list and restarted WWWPS

                Still no video connection. Sigh, this is weird. I am able to directory browse and I can see the videos.
                Something strange happens though. If I directory browse to /vids/, I can see all my FLV's. However when I click on one, it gives me a "Server Error" - Either the Macromedia application server is unreachable or it does not have a mapping to process this request.

                I changed my script a bit to point to another XML file located on the web, http://ws.jamesward.org/youtube.xml and modified my dataProvider and the source spots to fit his structure and it displayed his youtube videos.

                I'm going to try using full URL addressings for each video url on my XML file, though I think I did this already without progression.

                Let me know about that error I reported.

                EDIT: Using the full URL didn't work. It's still giving me a connection failed alert.
                EDIT2: I made a new mxml file with just a <mx:VideoDisplay> control only. I set the source to the full URL path of a single video on my server and tested the app locally. It would not display the video. I then set the source to the relative path of the same video on my local machine and the video played. So it's definitely something with my server handling these FLV's.
                EDIT3: Just to note, my server also has ColdFusion 7.0.2 running on it. I don't know if that explains the error above?
                • 5. Re: Need help setting up Flex on server (sdk?)
                  macnimation2 Level 1
                  Do you need to call the videos from the XML file or would calling them directly help?

                  It must be a path issue though.
                  • 6. Re: Need help setting up Flex on server (sdk?)
                    macnimation2 Level 1
                    Is that just a typo in the HTTPService :

                    I call it using an HTTPService
                    <mx:HTTPService id="srv" url="vids/lessonVids.xml"?>

                    There is a ? instead of the / after vids/lessonVids.xml

                    Is that just a typo in the forum?
                    • 7. Re: Need help setting up Flex on server (sdk?)
                      EvolvedDSM Level 2
                      Typo :P

                      I'm calling them from xml just to save my doc from extra code. I have tried calling them directly as my edit above stated.

                      Just using
                      import mx.events.VideoEvent;

                      <mx:VideoDisplay source=" http://<server ip>:8700/flex/Lessons/lessonVids/vids/vid_name.flv" width="x" height="y">
                      • 8. Re: Need help setting up Flex on server (sdk?)
                        EvolvedDSM Level 2
                        Ok, figured it out.

                        Adding FLV to the MIME extensions helped. However, I didn't have FLV in the mappings within the home directory tab of IIS. I added flv with the config of aspnet_iaspi.dll. Now my vid is working!

                        Thanks for the help all.