Search code examples
apache-flexactionscriptflex-spark

Flex Spark List item render with delayed refresh


I have a spark List in which I am adding custom components manually (without an item renderer). Everything is working fine except when I add hundreds of items in the list (based on several calculations), the render time increases to several seconds.

My questions are:

  1. Does flex automatically delay the rendition of components that are added to a list?
  2. If not then, how can I tell the spark list to only render the components once everything is added.

I hope what I am asking makes sense. I am pretty sure the render time is increasing because I have quite a few components inside the custom component. I just need a simple answer to my questions.


Solution

  • One more thing to know is that,

    ActionScript 3 runs on flash player based on even-driven. It means that if you run a chunk of code in blocking, anything else, including rendering, will not be executed until the code ends.

    This design sometimes causes issues: If a developer adds too much job in one blocking function, the player looks frozen and unresponsive momentarily. (If the code is an infinite loop, it stops until the player detects and throws ScriptTimeoutError, or possibly forever.)

    However, for your question, yes, anything will be delayed until the adding job is done. Flex components doesn't basically split the job automatically.