External Configuration Using Prana Framework – Simple Example
Adobe October 25th, 2008This post is a call to Flex Developers to start using the Prana Framework. If you want more information on Prana Framework then look at the site. Because a lot of developers probably get scared when hearing terms like Inversion of Control, Dependency Injection, Spring, … you can just go on without reading about this and check this simple example. The purpose is to configure some variables externally in a xml file using the Prana Framework. Other ways of doing this could be:
- Creating your own XML-file.
- Creating a txt file with key value pairs.
- Having some configuration info in your database.
In all three cases you would need to read the xml, txt or database data and parse it yourself in the application.
Prana does this all for you automatically. Get on to the example.
Example + source view : Right click swf –> View Source to see source.
The only lib you’ll need is prana-main.swc, which is in the libs folder.
The three files that I created are PranaExample1.mxml, Singleton.as and application-context-johlero.xml.
PranaExample1.mxml is the main application mxml. Singelton.as is a singleton with a few variables that will be set by Prana and application-context-johlero.xml is the XML file that will be read and parsed by Prana.
I have put comments in the three files that should be enough to understand the example.
In next examples I’ll show some more complex examples of what you can do with the Prana Framework. Anyway, their’s also documentation on the site of Prana Framework, so go and check it out.
Interview about Prana Framework on InfoQ
The Flex Show Episode 57: The Prana Framework with Christophe Herreman
Ciao!
(Thx to Herre aka Herrodius! Respect!)
Follow Me!