*All* external data calls in Flex are asynchronous. There is no way to force synchronous behavior. There in no code blocking. Resistance is futile. You must use the result event to organize the calls and any dependent responses.
This is a conceptual hurdle if you are not used to the idea, but is easily handled when you submit. One hint, all the rpc calls return an AsyncToken. This dynamic object can be populated with anything you need to identify a particular result. I use simple string properties, and a switch statement in the result handler, but you can also specify callback functions. Tracy Spratt, Lariat Services, development services available _____ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of ericmaslowski Sent: Wednesday, April 22, 2009 5:19 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Initialization Order - External Data Hello, I'm building a Flex app and it's been going fairly well. However, I've run into a problem when trying to load data from an external source (simple TXT file for now). I can't seem to control when a particular function is called. What I have is a series of components that are filled with images when the application starts. I want the list of images to come from a txt file (no problem with URLLoader). What I'm finding out is that the other functions in my init routine are called before I finish reading in the file. For example, I have a routine called from "creationComplete". function onStart():void { initDatabase(); initComponents(); } in the case above, "initComponents()" is called before "initDatabase" finishes and I get a bunch of broken image links. Any advice on how I can guarantee the above executes in order? Is there any way I can force Flex to operate in a very linear manner (at least for initialization)? Thanks! E.