6 Replies Latest reply on Oct 23, 2008 9:15 PM by *gsb*

    Flex properties file

    ac361 Level 1
      Hi. I've got some URL's in my Flex app that I'd like to pull into a properties file; the values will differ between our development and production systems. How do you get/set a properties file in Flex? Thanks.
        • 1. Re: Flex properties file
          Gregory Lafrance Level 6
          I don't think you can write to .properties files from a Flex app, only from an AIR app. You might want to use a SharedObject for developers, and the .properties file for production.
          • 2. Re: Flex properties file
            ac361 Level 1
            Thanks, Greg. Can you read from a .properties file? I just need to manually set some values in the .properties file (via a text editor) and then read it via Flex.
            • 3. Re: Flex properties file
              ntsiii Level 3
              The Flex project properties files do not exist at run-time.

              Are you speaking in general, of needing to initialize your application at run time with some values?

              The simplest way to do this is to pass the values into the Flex app from the html wrapper, via flashvars. You just need a different version of the wrapper for each different deployment. This is the way I do it. It also makes it easy to have different launch configurations in FlexBuilder.

              Another solution is to use HTTPService to load an xml file containing your initialization data. Of course that way you have to have an URL for the HTTPService...

              • 4. Re: Flex properties file
                Gregory Lafrance Level 6
                In general, .properties files are just text files, saved as UTF-8, so you can edit them in FB.
                • 5. Re: Flex properties file
                  Hi guys,

                  Does this mean Flex can not read a properties file on runtime? But the resource bundles allows us to read from properties file. I don't get it.

                  thanks in advance
                  • 6. Re: Flex properties file
                    *gsb* Level 1

                    You can read a "properties file" if it is on the server.

                    ...else Tracy has the correct idea of using the HTML wrapper and "flashVars" via a, say, PHP runtime generator.