My question is very simple: In flex3, is there a way to load an xml file synchronously?
I know how to load asynchronously, using a load event. This may be useful, or may not. I just want to read the file, parse it, do what I have to do with it, and continue executing code.
I have a component that uses an xml file to store some configuration parameters. I need to read the file when the object is initialized. However, with the event model, I can't control when the file is loaded, so I must write code to "wait" for the code to load. This is just ridiculous, or is it me? I want code like this:
var foo:Foo = new Foo(); //This constructor should read the xml and initialize the object.
foo.doSomething(); //When I call this method the xml must be already handled.
I can handle the xml file on the event, and it works fine, but the event fires after the doSomething method.
I hope I have explained myself. I think this should be really easy, but it's driving me crazy. I don't want to write code to wait for the event unless it's really necessary. I feel all this should be just one line of code!