How to configure the Air app to link to an external configuration file?

I would like to reference an external configuration file (e.g. * .ini) that will allow me to set configuration variables for each deployment of my Air application. Unfortunately, I could not find any information on the best way to solve this problem.

With that said, does anyone have any tips on how to do this?

+6
flex air configuration
source share
3 answers

Here's a small xml idea:

var file:File = File.applicationDirectory.resolvePath( "config.xml" ); var stream:FileStream = new FileStream(); stream.open( file, FileMode.READ ); config = new XML( stream.readUTFBytes( stream.bytesAvailable )); stream.close(); 

Just put the config.xml file in the src directory, it will appear in the installed folder when the release package is installed. I made config public var in my main application, so I can just do Application.application.config.someOption from anywhere in my project.

+9
source share

I do not know if there is an air center for this to happen. I did not find a good class in api docs. If you have many configuration options, you might have the idea of ​​looking for an existing library that might help you. But if you just need to save some simple settings, I would just create a small XML file and parse it using E4X.

It may be possible to jam it inside the application descriptor, but it will not be a good solution if you want someone to manually change some settings.

+1
source share

The easiest and easiest way is to use ticlib SimpleConfiguration, check out this blog post . since it is based on sharedobject, it can be used both in a FLEX application and in AIR.

0
source share

All Articles