tag:blogger.com,1999:blog-35088216.post6746136891955606949..comments2023-04-09T08:50:59.394-07:00Comments on Punctuated Equilibrium: Synchronous Service Calls in AS3Todd Cullenhttp://www.blogger.com/profile/08415290288342516108noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-35088216.post-30637413387503093672009-03-09T06:26:00.000-07:002009-03-09T06:26:00.000-07:00JC this example only works with Flex databinding. ...JC this example only works with Flex databinding. So if you are using regular flash this wouldn't work for you. You are correct that this isn't "true" synchronous Flex services. That doesn't exist in Flash (in the player internals, a new thread is created to execute service requests).<BR/>If you are using Flex, you create a new ArrayCollection in the first function and set that in the ModelLocator. Then, once the service returns you add items to the empty collection, filling it up. This will cause the ArrayCollection to dispatch "collectionChange" events, which Flex will use under the hood to rebind the data to any UIComponent you may have assigned it to.<BR/>Hopefully that makes sense. Sorry for the delay in getting back to you.Todd Cullenhttps://www.blogger.com/profile/08415290288342516108noreply@blogger.comtag:blogger.com,1999:blog-35088216.post-53766782600744645152008-12-31T06:59:00.000-08:002008-12-31T06:59:00.000-08:00This doesn't work at all. If you step through thi...This doesn't work at all. If you step through this exact example you'll see that the getDB() function returns before the data (ArrayCollection) is populated with anything. Am I missing something here?<BR/><BR/>Thanks,<BR/>JCAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35088216.post-83017764043002975612008-06-30T23:37:00.000-07:002008-06-30T23:37:00.000-07:00Nice post. If possible can you share the code with...Nice post. If possible can you share the code with us on the blog. ThanksPriyankhttps://www.blogger.com/profile/06462429850309921520noreply@blogger.comtag:blogger.com,1999:blog-35088216.post-54213407263179190382008-02-16T12:51:00.000-08:002008-02-16T12:51:00.000-08:00Actionscript is single threaded. The entire functi...Actionscript is single threaded. The entire function body will always be executed before handling the result of a service call. But for what its worth, there's no reason not to move that line up above the service call.Todd Cullenhttps://www.blogger.com/profile/08415290288342516108noreply@blogger.comtag:blogger.com,1999:blog-35088216.post-5763302545553993442008-02-14T18:50:00.000-08:002008-02-14T18:50:00.000-08:00you have a possible race condition.your data Array...you have a possible race condition.<BR/><BR/>your data ArrayCollection object is created AFTER your call to loader.load(...) and in the oncomplete you then reference data which may possibly still be null.Carlos Sola-Llonchhttps://www.blogger.com/profile/14913854833133323550noreply@blogger.com