tags:

views:

13

answers:

1

I have a method that I want to be enqueued to the UI thread message pump. How is this done in actionscript? Basically I am looking for the equivalent of System.Windows.Deployment.Current.Dispatcher.BeginInvoke() in actionscript.

A: 

All timing in the Flash Player eventually comes back to the frame rate.

Not knowing exactly what the windows API you mention does, I can only assume it sets up a method to be run at a later point (say when needed by the UI, or when the UI is about to refresh).

If that's the case then you can simply setup your method to be run on the next ENTER_FRAME or EXIT_FRAME event. In both cases you need a DisplayObject to tap into (the stage is fine). There is no built-in one-shot event subscription in AS3 at this time, so you'll need to have a stub method that runs the function you want run and then removes the event listener.

Branden Hall