Flex equivalent of ProcessMessages and unresponsive UI during long loops

前端 未结 5 2278
陌清茗
陌清茗 2020-12-17 19:00

I find that my Flex application\'s UI becomes unresponsive during very long processing loops (tens of seconds). For example, while processing very large XML files and doing

5条回答
  •  情书的邮戳
    2020-12-17 19:31

    The problem is that Flash is single threaded, i.e. until a part of the code is running, no other processing can be made. You'll somehow need to break up the processing into smaller chunks and execute these chunks, say, on the enterFrame event.

    Edit: I'm afraid that downvoting this (or Simon's) answer does not change the fact that this is not doable in AS3. Read this article for more insight on the problem. The article also includes a simple "library" called PseudoThread, which helps in executing long background computations. You still have to break up the problem into smaller pieces yourself, though.

提交回复
热议问题