callLater() in Flex

On October 26, 2007, in Flex, by Anuj Gakhar

callLater() is a function thats rarely talked about and not very well documented as well but I find it rather very useful in some instances. Its quite handy when you want the UI to update and you do a series of things at once. Before each update of the screen, the Flash Player calls the set of functions that are scheduled for the update. Sometimes, a function should be called in the next update to allow the rest of the code scheduled for the current update to be executed. Some features, like effects, can cause queued functions to be delayed until the feature completes.

e.g. if you call a webservice or HTTPService onGridChange event, you will have to wait for that event to complete before you fire off another call to another HTTPService etc. This is where it gets very handy.

Details here .

Its syntax is simple.

[source:xml]callLater(‘name of the function to execute’, args);[/source]

Tagged with:  

2 Responses to callLater() in Flex

  1. abhishek says:

    r u have any good example to understand this, why actually it needed?, we can also use addEventListener to get sequense

  2. Anuj Gakhar says:

    @abhishek, imagine you have a button click event that loads data from a XML file or a webservice. That loading of data would probably have another resultHandler which will wait for the loading to finish. And meanwhile your button click handler might be doing some other things …so in these kinda situations you can use callLater. hope that helps.

Leave a Reply to Anuj Gakhar Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar
%d bloggers like this: