Loading an XML configuration file BEFORE the flex application loads
Posted
by Shahar
on Stack Overflow
See other posts from Stack Overflow
or by Shahar
Published on 2010-04-19T05:32:39Z
Indexed on
2010/04/19
5:33 UTC
Read the original article
Hit count: 279
Hi,
We are using an XML file as an external configuration file for several parameters in our application (including default values for UI components and properties values of some service layer objects). The idea is to be able to load the XML configuration file before the flex application initializes any of its components. This is crucial because XML loading is processed a-synchronously in flex, which can potentially cause race-conditions in the application.
For example: the configuration file holds the endpoint URL of a web service used to obtain data from the server. The URL resides in the XML because we want to allow our users to alter the endpoint URL according to their environment. Now because the endpoint URL is retrieved only after the XML has been completely loaded, some of the application's components might be invoking operations on this web service before it is initialized with the correct endpoint. The trivial solution would have been to suspend the initialization of the application until the complete event is dispatched by the loader. But it appears that this solution is far from being trivial. I haven't found a single solution that allows me to load the XML before any other object in the application.
Can anyone advice or comment on this matter?
Regards, Shahar
© Stack Overflow or respective owner