![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
I have the following code:
....... public function foo():void { loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onComplete); loader.load(new URLRequest(filename)); } ...... The caller for foo needs to get some fields that are set by the onComplete function. Since foo returns before onComplete returns, the caller is unable to get the correct value. How do I specify that I want to wait for onComplete to finish before foo() returns? Thanks. |
| Sponsored Links |
|
|||
|
Can you please explain why this is not advisable? I feel that doing it your way
would mix, in my case, the model and the view. Here's a simplified version of what I'd like to do: Parse the XML, create an instance of the model (a .as class file). The view then gets updated with the model (from a .mxml file) contents. If I do things as you suggest, I'd have to pass a handle to the view into the onComplete method that's a part of the model. In case I need to update more than once, then your other suggestion of handling a custom event also seems a bit unwieldy: I'd have to keep some flag to know if the event has occured or not, so that the first view update happens in the handler which only gets called once and sets the flag, and the next updates need to rely on the flag being set. I'm sure that it has been implemented this way for a very good reason. I'm probably missing the right way to do this all!! Can you please explain it? Thanks!! |
|
|||
|
"ks_flex_user" <webforumsuser@macromedia.com> wrote in message news:gd77k7$6rl$1@forums.macromedia.com... > Can you please explain why this is not advisable? I feel that doing it > your way > would mix, in my case, the model and the view. Here's a simplified version > of > what I'd like to do: Parse the XML, create an instance of the model (a .as > class file). The view then gets updated with the model (from a .mxml file) > contents. If I do things as you suggest, I'd have to pass a handle to the > view > into the onComplete method that's a part of the model. In case I need to > update > more than once, then your other suggestion of handling a custom event also > seems a bit unwieldy: I'd have to keep some flag to know if the event has > occured or not, so that the first view update happens in the handler which > only > gets called once and sets the flag, and the next updates need to rely on > the > flag being set. > > I'm sure that it has been implemented this way for a very good reason. I'm > probably missing the right way to do this all!! Can you please explain it? > Thanks!! http://www.adobe.com/devnet/flex/art...ating_pt1.html |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise