In Flash there's no way to block or wait for a network operation to complete. The sooner you surrender to listening on events or using responders the happier you'll be ;)
It's definitely a paradigm shift for folks coming from Java or other languages that support synchronous/blocking operations. The player uses a single thread to manage the UI and execute ActionScript and when a network operation is invoked, rather than block all playback and script execution the request is queued with the networking layer and executed separately from the primary thread. When data arrives from the network, it is passed back to the primary thread to be processed when it advances to the next frame and executes more script. Event handling can be more awkward to code for, but it's what allows swfs running in the player to remain responsive to user interaction (almost) all the time. Seth ________________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dylan Schorer Sent: Wednesday, October 25, 2006 3:32 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: DataService-ArrayCollectionissue Thank you. That was the issue. Is there a way to have the ds.fill command work syncronously and wait for the ResultEvent before continuing, rather than custom coding an event listener. --- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]> wrote: > > Have you waited for the ResultEvent confirmation from the fill operation > before accessing the collection? > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Dylan Schorer > Sent: Wednesday, October 25, 2006 5:13 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] DataService-ArrayCollectionissue > > > > Hi, > When using an ArrayCollection populated using a DataService.fill > command, the length and .itemAt methods behave differently than with a > manually populated array. > > When I call ds.fill on an ArrayCollection, the data is successfully > retrieved, and can be displayed in a data grid. Though, if I call > collection.length, it always returns 0, and calling itemAt(x) always > results in an index-out-of-bounds error. How can you get correct data > from these methods, just as you would from a manually populated > ArrayCollection? > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/