| QUOTE (geniusalz @ Feb 3 2004, 10:56 PM) |
Cool. So you mean there will be a main loop, and events will be treated as GOSUBs from the main loop?
Can you also add timers as controls? |
Yes, Events will be handled a lot like gosubs.
Scripters will call
CreateMenu <HandleName> <XMLHandle> or CreateDialog <HandleName> <XMLHandle>
then somewhere else call
ExecuteUIObject <HandleName> <Label>
ActionScript will not execute any more commands until an event occurs. At that point, it will perform something similar to a GOSUB to the Label given, filling in event details into the local variable space. RETURN will pause ActionScript execution until the next event.
Events will be pumped into an event queue, so you shouldn't lose any events.
When the dialog or menu goes away, the script will resume where the ExecuteUIObject call was made - so you could, for example, call CloseUIOBject <HandleName> in your event handler to dispose of the dialog - the next Return would jump to the line following the original ExecuteUIObject call.
I have to take care, because a UI event can (and should) be able to create and execute new UI objects, so the return to execution of a cleared dialog, for example, should then pop the stack to the previous exeution thread.
Anyway.... I'm sorting all that out.
As for timers, sure.... shouldn't be a problem. I also have to consider the issue of modeless dialogs (no event handler, per se, but AS will manipulate them, such as a progress dialog, and perhaps read events from the queue)