I would do:
//the rectangle you would like to draw
var rectangle:Rectangle = new Rectangle(100,100,400,500);
var shape:Shape = new Shape();
var matrix:Matrix = new Matrix(1,0,0,1,-rectangle.x, -rectangle.y);
shape.graphics.beginBitmapFill(bitmapData, matrix);
shape.graphics.drawRect(0, 0, rectangle.width, rectangle.height);
shape.graphics.endFill();
You can then scroll by changing the rectangle's position, or changing the matrix directly.
UPDATE:
After checking Myk's answer, I was surprised to find (after fairly quick and loose tests) that beginBitmapFill appears to be actually faster than copyPixels. I'll leave my tests codes, so if you're interested have a go at it:
copyPixels (I get 15-20 fps):
var bmp:BitmapData=new BitmapData(1000, 1000, true, 0);
bmp.perlinNoise(100, 100, 3, 1, true, true);
var arr:Array=new Array();
for (var i:uint = 0; i < 50; i++) {
var clip:Bitmap = new Bitmap(new BitmapData(500, 500));
addChild(clip);
clip.alpha = .05;
arr.push(clip);
}
var t1:uint = getTimer();
stage.addEventListener("enterFrame", function() {
trace(getTimer() - t1);
t1 = getTimer();
for each(var clip:* in arr) {
var x:uint=Math.random()*100;
var y:uint=Math.random()*100;
clip.bitmapData.copyPixels(bmp,new Rectangle(x,y,500,500), new Point);
}
});
and beginBitmapFill (I get 55-60 fps):
var bmp:BitmapData=new BitmapData(1000, 1000, true, 0);
bmp.perlinNoise(100, 100, 3, 1, true, true);
var arr:Array=new Array();
for (var i:uint = 0; i < 50; i++) {
var clip:Shape = new Shape();
addChild(clip);
clip.alpha = .05;
arr.push(clip);
}
var t1:uint = getTimer();
stage.addEventListener("enterFrame", function() {
trace(getTimer() - t1);
t1 = getTimer();
for each(var clip:* in arr) {
var x:uint=Math.random()*100;
var y:uint=Math.random()*100;
clip.graphics.clear();
clip.graphics.beginBitmapFill(bmp,new Matrix(1,0,0,1,-x,-y),false,false);
clip.graphics.drawRect(0,0,500,500);
clip.graphics.endFill();
}
});