2
votes

Does anyone have any knowledge (preferably with links to make it official) about how/if Flash/Flex culls objects not in view, to stop them getting drawn when not needed?

A specific cases:

I have an 800x600 panel (a Canvas or Sprite, or other container) containing loads of Sprites representing individual game objects like asteroids or spaceships or missiles or map-tiles. The game world might be 5000x5000 so can I naively position Sprites anywhere in this range and let Flash cull them effectively? Or do I need to manage visibility somehow at a higher level (like manually removing them from the parent) to avoid performance issues?

1
You might need to clarify somewhat. What do you mean by cull? Garbage collect?Gregor Kiddie
I mean more like clipping, i.e removes them from the render-listMr. Boy
+1 Good question, and something I've wondered myself. I can tell you from experience that items within the "viewport", but completely obscured by other items, making them effectively invisible, still get drawn. I can't speak to the case where items are outside of the "viewport" however.Wade Mueller

1 Answers

1
votes

The game world might be 5000x5000 so can I naively position Sprites anywhere in this range and let Flash cull them effectively?

I guess, no. Flash has limits for stage size (4050x4050 for 10.1, if I remember correctly) and above that size nothing is guaranteed (rendering artifacts and crashes are possible). Also, having overpopulated display list doesn't help Flash to render fast. You should consider to make at least coarse-grained "screen-culling" yourself.