Flex equivalent of ProcessMessages and unresponsive UI during long loops

前端 未结 5 2256
陌清茗
陌清茗 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:47

    Actionscript is single threaded by design, no amount of downvoting answers will change that.

    For compatibility your best bet is to try to split up your processing into smaller chunks, and do your processing iteratively.

    If you absolutely need threading it can sort of be done in Flash Player 10 using Pixel Bender filters. These will run on a separate thread and can give you a callback once they are done.
    I believe they are well suited for "hardcore" processing tasks, so they might fit your purpose nicely. However, they will put a whole other set of demands on your code, so you might be better of doing small "buckets" of computing anyways.

提交回复
热议问题