Tiling an image using BitmapData.draw()

I’m loading in a large external swf image, and trying to cut it up into stage-sized chunks using BitmapData.draw() with a clipRect parameter, then draw those chunks back onto the stage, essentially producing the same-looking image as the swf.

However, the only thing that is drawing is the first chunk (the one that would appear at 0, 0). The rest are just coming out blank (but in the right spot on the grid).

Here’s my code. Anyone know what the problem is?

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest("midgroundBack.swf"));

var tileArray:Array = [];

function onLoadComplete(event:Event):void
{
    var l:Loader = event.target.loader as Loader;
    
    var stageWidth:Number = stage.stageWidth;
    var stageHeight:Number = stage.stageHeight;
    var nColumns:Number = Math.ceil(l.width / stageWidth);
    var nRows:Number = Math.ceil(l.height / stageHeight);
    trace("Column count: " + nColumns);
    trace("Row count: " + nRows);
    for (var i:int=0; i<nRows; i++)
    {
        tileArray* = [];
        for (var j:int=0; j<nColumns; j++)
        {
            var rect:Rectangle = new Rectangle(j*stageHeight, i*stageWidth, stageWidth, stageHeight);
            var bd:BitmapData = new BitmapData(stageWidth, stageHeight, true, 0x00000000);
            bd.draw(l, new Matrix(), new ColorTransform(), "normal", rect);
            var bitmap:Bitmap = new Bitmap(bd);
            var sprite:Sprite = new Sprite();
            sprite.addChild(bitmap);
            tileArray*[j] = sprite;
            sprite.x = j * stageWidth;
            sprite.y = i * stageHeight;
            addChild(sprite);
            trace("X: " + sprite.x + ", Y: " + sprite.y);
        }
    }
}

Essentially, I’m trying to get a grid of stage-sized images rather than one large image.

Thank you,
Eric Smith