Simple tip of the day – scrollRect
Posted on April 3, 2009
Whenever I’d need a “window” style mask I’ve always created some sort of DisplayObject (preferably a Shape) and used this as a mask for the content that need to be cropped.
However I recently discovered the handy scrollRect property. It’s available for every object that extends DisplayObject. It expects a Rectangle object and creates a mask according to those boundaries you specified as arguments.
- You have reduced it to one line of code
- You have one less object on stage.
- You could experience some performance boost (see gskinner.com)