动作:推着封闭到事件堆栈?堆栈、推着、动作、事件

2023-09-09 21:32:19 作者:孤独者何惧i

在的场合,我一直想封闭推到ActionScript中的事件堆栈,使其当前的事件处理程序后执行。现在我用的setTimeout(闭合,0)。是否有这样做的更直接的方法?

On occasion, I have wanted to push a closure onto ActionScript's event stack so that it will be executed after the current event handler. Right now I use setTimeout(closure, 0). Is there a more direct way of doing this?

推荐答案

的setTimeout(闭合,0)创建一个新的事件堆栈。我不明白你的目标,如果这个解决方案是不为你工作。什么是你要完成的目标是什么?

setTimeout(closure, 0) is creating a new event stack. I don't understand your objective if this solution isn't working for you. What is the goal you're trying to accomplish?

Flex有ENTER_FRAME事件,定时器,使用callLater,的setTimeout,setInterval的,所有这些都拖延通话和创造新的执行堆栈。

Flex has ENTER_FRAME events, Timer, callLater, setTimeout, setInterval, all which delay calls and create new execution stacks.

您试图注入code到当前栈?如果是这样,你可能需要看是这样的: http://en.wikipedia.org/维基/ Active_object 。这个想法是,你把函数(闭包)到一个数组,而活动对象控制器拉扯下一个关闭时,previous一个人完成运行列表中。这是最简单的情况。你可以写一个更复杂的,将优先栈一样高,中,低,与自己的日程管理系统。 (例如,等待时间过长后低得到提升)。

Are you trying to inject code into the current stack? If so, you might need to look at something like this: http://en.wikipedia.org/wiki/Active_object. The idea being that you push functions (closures) into an array, and the active object controller pulls the next one off the list when the previous one has run to completion. That's the simplest case. You can write a more complicated one that will have priority stacks like high, medium, low, with your own schedule management system. (e.g., low get promoted after waiting too long).

但是,嘿!魔鬼在细节。有什么目标?

But hey! The devil is in the details. What's the goal?