I have been having a problem getting sprites to clip nicely against a screen border.
As an example I have a stage that is 600x400 and there are lots of sprites moving around inside it. When they go outside the 600x600 border they don’t get clipped against the edges, they just keep on being visible. They also seem to stretch the stage so that it automatically gets bigger in order to accomodate them. This looks a bit strange on a web page.
I have been able to solve the problem by using a frame buffer (i.e. drawing everything onto a back buffer and then copying only the desired viewing rectangle onto my visible screen). However this isn’t ideal if you want to interact (i.e. click) things in your screen, as you are only seeing a bitmap ‘photo’ of them and not the real objects.
I have looked into masking which I have been able to get working but it seems to require an instance of a mask for each display object which looks a bit like overkill for my simple rectangular case.
Is there a way to specify a display rectangle and then have flash only display content from the stage clipped against the inside of that rectangle?