views:

29

answers:

1

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  A: 

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.

alxx
This is the limit for the stage size, not for DisplayObjects. They can be bigger. In FP10 and later, Bitmaps max out at 16,777,215 pixels (4096*4096) and I'd guess the vector based types can go even bigger although I can't find any numbers for those.
grapefrukt
But John wants to put all his sprites on stage, or so I understood. What's the point to hold large sprite in memory if you cannot show it? You can store children sprites in more convenient structures.
alxx