Hey flexers, I've been researching the various ways that one can delay a function's execution. A few ways I've found/used are:
(1) Use a Timer object with 0 delay as is done in StyleManagerImpl.loadStyleDeclarations2(). (2) Use setTimeout() (supposedly deprecated?) (3) Use callLater if you're in a UIComponent. (does it actually wait a frame or just till rendering beings?) (4) If you're not in a UIComponent, use the same logic that's found in UIComponent's callLater. It appears to add an event listener to the stage (using SystemManager to access the stage) for Event.RENDER and Event.ENTER_FRAME then invalidates the stage. First, is callLater meant to wait until the next frame or just until the render segment of the elastic racetrack? Second, which would you recommend and why? Third, why does the Flex framework use varying methods of waiting a frame (see #1 and #4)? The answer to my first question might answer this one. Fourth, why does callLater watch for both Event.RENDER and Event.ENTER_FRAME event types and not just one or the other? Thanks for answering my questions. I appreciate it. Aaron