 
 import flash.display.Bitmap;
 import flash.display.BitmapData;
+import flash.display.Shape;
 import flash.display.SimpleButton;
 import flash.display.Sprite;
 

        var window :Window = getWindow(id);
        if (window != null) {
            addDirtyRegion(new Rectangle(window.bounds.x + source.x, window.bounds.y + source.y,
                source.width, source.height));
            addDirtyRegion(new Rectangle(window.bounds.x + dest.x, window.bounds.y + dest.y,
                source.width, source.height));
            window.moveContents(source, dest, fill);
        }
    }

    /**
     * Adds a region to the rectangle that will need updating.
     */
    protected function addDirtyRegion (region :Rectangle, color :uint = 0xFFFFFF) :void
    {
        _dirty = _dirty.union(region);

        if (_debugRegions) {
            var cbounds :Rectangle = _field.getCharBoundaries(0);

            // add the outline of the region
            var shape :Shape = new Shape();
            shape.graphics.lineStyle(1, color);
            shape.graphics.drawRect(0, 0, cbounds.width*region.width,
                cbounds.height*region.height);
            shape.x = _field.x + cbounds.width*region.x +
                (_field.width - cbounds.width*_width)/2;
            shape.y = _field.y + cbounds.height*region.y +
                (_field.height - cbounds.height*_height)/2;
            addChild(shape);

            // remove it after a second
            var timer :Timer = new Timer(1000, 1);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE, function (event :TimerEvent) :void {
                removeChild(shape);
            });
            timer.start();
        }
    }

    /**
