Flex equivalent of ProcessMessages and unresponsive UI during long loops

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

    There is no equivalent functionality in Flash Player. By design, Flash Player alternates between rendering to the screen and then running all of the code for each frame. Using Event.ENTER_FRAME events on display objects, or Timer objects elsewhere, are the best bet for breaking up very long calculations.

    It's worth noting that some events in ActionScript have an updateAfterEvent() function with the following description:

    Instructs Flash Player or the AIR runtime to render after processing of this event completes, if the display list has been modified.

    In particular, TimerEvent, MouseEvent, and KeyboardEvent support updateAfterEvent(). There may be others, but those are the ones I found with a quick search.

提交回复
热议问题