I figured out the problem.

org.apache.flex.utils.callLater has the following code:
setTimeout(makeCalls, 0);

That compiles to:
setTimeout(org.apache.flex.utils.Language.closure(makeCalls, this, 
'makeCalls'), 0);

When Language.closure is called, it messes up the scope of the calls variable 
and subsequent calls to makeCalls step on each other. I believe this is because 
makeCalls is bound to the package object of the callLater function.

Is there any way to prevent rewriting of function calls to Language.closure?

If "setTimeout(makeCalls, 0);" is cross-compiled exactly to: 
"setTimeout(makeCalls, 0);", it works like I’d expect it to.

Thanks,
Harbs

> On Jul 16, 2017, at 3:46 PM, Harbs <harbs.li...@gmail.com> wrote:
> 
> Interesting to note:
> 
> Adding a number of callLater() calls resulted in only the first one being 
> called in JS. I did not try as a SWF.

Reply via email to