4 Replies Latest reply on Sep 6, 2009 9:38 AM by Steviewonders3

    Flex app doesn't work when moved from original location

    Steviewonders3

      I'm trying to make an image gallery in flex. It works when I run it in Flex Builder perfectly fine. The html and swf files from the bin-debug folder work perfectly fine when opened in any browser also, but ONLY when those files and all related files are opened from the default location that the application was built in. When I export a build to a different folder, the swf loads but none of the information from the xml file displays. I tried setting all of the paths of the reference files (namely the xml) in the flex app to the exact absolute location on the server, and it still didn't work when I uploaded it to the server.

       

      I've tried several approaches starting from scratch and they have all come up with the same issue. I'm working with an educational license for Flex Builder, I'm not sure if they jip you on those and ruin the compiled swf.

       

      Please help! I'm losing my mind over this.I think it has to do with something else besides the code since it works fine when I hit "Run", but if anyone thinks it will help to post the code let me know.

        • 1. Re: Flex app doesn't work when moved from original location
          Flex harUI Adobe Employee

          When you run from FlexBuilder, the url usually starts with file://

          When you run from a server, the url usually starts with http://

           

          The security rules for file:// and http:// are different.  Usually, if you use relative paths and everything is in a subfolder of bin-debug or bin-release, it should move cleanly to a server.  Make sure you didn't accidentally use a file:// url in your code.

           

          If you are accessing URLs from different domains you will need to understand cross-domain security.  There are Security WhitePapers on the Adobe web site.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: Flex app doesn't work when moved from original location
            bryn51

            when you build an application using one of the wizards (like coldfusion flex application wizard) it hard codes

            paths to cold fusion CFC's, and sometimes gets it wrong.

             

            If your application references cfc's (or other remote objects) then it may be necessary to adjust the flex code

            when moving the code into a different base folder.

             

            For example in my own application, the url is http://localhost/crm_dev_flex and the built application gets put into

            c:\inetpub\wwwroot\crm_dev_flex\bin-debug

             

            References in the code to components found in c:\inetpub\wwwroot\crm_dev_flex\bin-debug\components\cfgenerated

            (in the flex code these looks like crm_dev_flex.bin-debug.components.cfgenerated.<mycomponent> )

             

            These need to change when you move the code to somewhere else.

            Also, if you are using wizard generated cfc's then these also contain similar references that need to be changed.

             

            IHTH.

            Cheers

            • 3. Re: Flex app doesn't work when moved from original location
              Gregory Lafrance Level 6

              Often this is because you need to add the -use-network=true compiler option in the FlexBuilder menubar:

               

              Project - Properties - Flex Compiler - Additional compiler arguments:

               

              add      -use-network=true     and then recompile and post to server, should work fine.

               

              Note: if you create a "release build" and move it elsewhere on your local machine, you may need to add  -use-network=true     and then recompile for the app to be able to access local resources outside the Flex Builder environment.

               

              If this post answers your question or helps, please mark it as such.

              • 4. Re: Flex app doesn't work when moved from original location
                Steviewonders3 Level 1

                Thanks to everyone for answering.

                 

                Greg - Thanks a million, works perfectly!