Is there a performance and/or memory usage difference between these two scenarios?
scenario 1: N visual elements all added to stage; N-1 have visible = false, 1 has visible = true;
scenario 2: N visual elements, only 1 added to the stage at any time.
thx!
Visible = falseis far faster.Colin Moock has weighed in on this issue in a definitive manner.
His findings:
His basic guidelines are :
removeChild()– for predictable control of the display list, add and remove.visible=false– for straight up performance,visibleis clearly faster;As far as “predictability” is concerned, we often use the display list as a stack to identify and control display objects. If you are leveraging visibility, you loose that state (which can be a big deal). Conclusively, though, if performance is required the winner is clear.
I realize your post is directed at Flex but I think, in this case, we’re talking the behavior of an SWF and so flex/flash shouldn’t matter.