Skip to main content
Participant
August 18, 2008
Question

loading config settings from XML

  • August 18, 2008
  • 2 replies
  • 323 views
So I have some code that needs a bunch of configuration settings to be set first before it executes.
Since I want the settings to be enviroment-specific and easily customizable I put them all in an XML file. The problem is that I need to ensure that the settings have completed loading into my class variables BEFORE any functions are invoked on the object (because otherwise it will break since the settings aren't done being 'set').

How can I accomplish this? Its like I need a preloader or initializer for my class?
This topic has been closed for replies.

2 replies

snafu7x7Author
Participant
August 19, 2008
not quite that simple...the class in question is a standalone AS class so as soon as you instantiate it you can call any of its functions, I need to ensure that the settings are set before I allow this, maybe I need to rethink my design I dunno.

any other ideas?
Known Participant
August 18, 2008
I know next to nothing about Flash, so sorry in advance if I'm wrong.

XML.onData seems to do the trick. Just queue your "main" function for loading after the XML has loaded. If you're using a frames-based system, set the first frame to a loading screen and disable automatic playback. Queue your load on the first frame and add a callback function that enables playback for onData.
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001950.html