var rect:Rectangle = new Rectangle(0,0,100,100);
image_mc.scrollRect=rect;
stage.addEventListener('mouseDown',d);
function d(event:MouseEvent):void {
rect.x = Math.random() * image_mc.width;
rect.y = Math.random() * image_mc.height;
//image_mc.x = rect.x;
//image_mc.y = rect.y;
image_mc.scrollRect = rect;
image_mc.scrollRect=rect;
stage.addEventListener('mouseDown',d);
function d(event:MouseEvent):void {
rect.x = Math.random() * image_mc.width;
rect.y = Math.random() * image_mc.height;
//image_mc.x = rect.x;
//image_mc.y = rect.y;
image_mc.scrollRect = rect;
}
一个显示对象mc,设置了scrollRect之后,只在mc的坐标位置显示scrollRect对应位置矩形区域的显示部分