I think the best solution for Flash would be to introduce a first-class thread object. That way developers could spawn long-lasting tasks to a separate thread. Issues like Alex mentioned could be avoided by putting restrictions on what threads could and could not do... for example, you don't have the doEvents issue of "rentrance" without adding complications to the code.
The Player could also put bounds on the threads, such as capping their CPU usage and/or limiting their ability to access data outside of their owned object (to prevent a bunch of synchronization primitives from being introduced into the API). Essentially, allow users to create async objects (like Loader) that can run, can update their properties, etc., fire events (which wouldn't have thread sync issues because they can be process async'ly like mouse events or other Player events). I'm sure there are some wrinkles I'm overlooking, and I'm sure I'm oversimplifying. But I think the Flash Player team will really need to tackle the threads issue sooner rather than later if they want it to become a platform of choice for RIA's... C# and Java already support threads 100%, and let's not kid ourselves, Flash is competing with those platforms in many shops. Troy. On 5/2/07, Alex Harui <[EMAIL PROTECTED]> wrote:
Calllater, intervals and what not are good for long iterations. Sometimes you want to run a deep recursion and that's harder to flatten. The Player Team continues to reject this idea. I think it is because it is non-trivial to implement as it means that a mouseevent could be processed before the mouseevent that called doEvents finishes and that makes somethings in the player more complicated. -Alex ------------------------------ *From:* [email protected] [mailto:[EMAIL PROTECTED] *On Behalf Of *Jim Grinsfelder *Sent:* Wednesday, May 02, 2007 2:00 PM *To:* [email protected] *Subject:* RE: [flexcoders] Why aren't we allowed to process the event queue? (eg: like DoEvents) Maybe we already can tell flash to process the UI event queue... What happens when you use CallLater() to call yourself back? ------------------------------ *From:* [email protected] [mailto:[EMAIL PROTECTED] *On Behalf Of *Tim *Sent:* Wednesday, May 02, 2007 2:41 PM *To:* [email protected] *Subject:* [flexcoders] Why aren't we allowed to process the event queue? (eg: like DoEvents) Why aren't we allowed to tell flash to process the UI event queue periodically in long executing subroutines? Hell, just something to tell the client not to go into "Not Responding" would be more than enough. I call "validate now" periodically, but that doesn't help because I still get the "Not Responding" which makes it look like the software has crashed - a very awkward user experience. It seems like such a trivial thing for Adobe to add. Why don't they?

