Watchable Events added to GEMVC trunk
If you ever have multiple events that run simultaneously on common data or GUI controls (for example manipulating multiple tree controls all bound to the same model variable) you have wait until one event is finished before executing the other. Previously, the only way to do this was to have your event handlers set a global flag and your event that dispatched the events must check this flag and then use callLater to keep looping until the flag is set. Now, GEMVC includes a MVCWatchableEvent class that all your events can extend. In your event handlers you can now automatically watch an event for it to complete and then perform further actions. You only need change your dispatchEvent call in the calling event handler and place a done() call in the event that you are watching when the event processing is complete. For example, I have an event handler that among other things uses a shared object to restore the state of various trees in the application. Since I have multiple trees that all share the same data provider they have to be done sequentially. So inside handleEvent() of my event I call:
var ev:ExpandHierarchyEvent = new ExpandHierarchyEvent(model.savedState.data.savedInfo);
onMVCEventComplete(context,ev,sequentialFunction,[context]);
Inside my ExpandHierarchyEvent I place a call to done() when my event completes normally.
Make sure both events extend the MVCWatchableEvent class.
Update your code from the trunk to get the new change.

There are no comments for this entry.
[Add Comment]