Wednesday, December 21, 2005

scrollRect : easy 'masking'

Before Flash 8, if you wanted to create a window with scrollable content, you'd have to mask the content. I always felt a little uncomfortable using this approach.
In Flash 8 you can use the new movieclip.scrollRect property.
There is an easy copy/paste example in the help files, but this is what it comes down to :

import flash.geom.Rectangle;
var container:MovieClip = mclip;
var window:Rectangle = new Rectangle(100, 0, 200, 40);
container.scrollRect = window;

mclip in this example is my 'content' movieclip in my scene. By using .scrollRect, mclip will be 'masked' according to the Rectangle properties.

Nice and clean...

1 Comments:

Anonymous Anonymous said...

exactly what i was looking for, thanks.

3:19 AM  

Post a Comment

<< Home