Hi there, I have instantiated a class (class1) that loads some data via PHP in an AS3 Flex project. I instantiate class1, which is asynchronous and utilizes a URLLoader() to obtain its data.
Then I would like to instantiate class2, which needs to USE the data from class1, but when I simply instantiate it I find that class1's instance variable is not populated yet because I am calling class2 too quickly.
How can I create such a dependency that will link correctly? I am really new to using listeners, but I am imagining a listener in class2 might be what I need? Or maybe I can pass a reference to the listener in class1 into class2? I also know nothing about dispatching events... is this the key?
Here's an example in pseudo code:
var class1:myC1 = new myC1("http://some/url/to/utilize");
//this never shows up because it hasn't loaded at the time i request it
trace("the stuff from class1 is: ", class1.myXMLList);
//and of course i can't use it here either
var class2:myC2 = new myC2(0x000000, class1.myXMLList);
Thanks for any help, jml