Manage my bundle

Traditionally used for managing locale settings especially languages the ResourceManager in Flex 3 can also be used for loading in other environment variables.

On my development machine I’m loading in service URL’S, dummy sessions and a few other things. One other option would be to hard code test data into a static class but because these values are used for more than one application it allows me to change this values in a single location.

You first need to declare your source path to your resources. The file that you wish to read using the Resource Manager needs to be a .properties file. This is just a standard text file with the name of your resource bundle suffixed with a .properties.

The structure of this file is the property and then the assigned value. Comments can be incorporated by implementing the hash symbol.


#this is the riality resource bundle
uploadURL = http://localhost/testApp/upload.cfm
companyID = 1212

Store this file in a local directory. For this test application I have mine structured like so. I have this example setup in my Flex 3 SDK directory. Notice that the I’ve used the “en_US” named folder, this is the default locale for the flex compiler, but allows us to add other locales if need be by simply adding creating another locale named folder and providing the same .properties files.

Now you’ll need to set your source patch for the resource bundle. To do this right click on your flex project. Click on the Flex Build Path from the left hand menu. Click the Source Path menu Button. Here you have the option to add a source path folder.

Click the Add Folder button and browse to your resource bundle directory and click ok. However where replace the “en_US” with the special characters {locale}. This is set by the flex compiler additional arguments. You can see this when you click on the Flex Compiler in the left hand menu.

After that you’re right as rain to start accessing your bundle in your Flex 3 Application.


[ResourceBundle("riality")]
private var companyID : String = ResourceManager.getInstance().getString("riality","companyID");

Bundles have never been easier to manage. You could say it makes it a real bundle of joy to manage.

Leave a Reply

Your email address will not be published. Required fields are marked *