scale9grid problem

hello all,
i am trying to set scale9grid property of a mouse following rectangle in as3.
i am drawing a rectangle by dragging mouse.
can i set this rectangle scale9grid property?
i have written the following code but it displaying argument error.
i am using a helper class to set the scale9grid which is as follows:

“helper class”
package lib
{
import flash.display.Sprite;
import flash.geom.Rectangle;
public class Scale9Helper
{
public static function setScaleGrid( target:Sprite, offset:uint ):void {
var grid:Rectangle = new Rectangle( offset, offset, target.width - ( offset << 1 ), target.height - ( offset << 1 ) );
target.scale9Grid = grid;
}
public static function showScaleGrid( target:Sprite, lineColor:uint = 0x00ff00 ):void {
var targetScaleRect:Rectangle = target.scale9Grid;
target.graphics.lineStyle( 2, lineColor );
target.graphics.moveTo( 0, targetScaleRect.y );
target.graphics.lineTo( target.width, targetScaleRect.y );
target.graphics.moveTo( targetScaleRect.x, 0 );
target.graphics.lineTo( targetScaleRect.x, target.height );
target.graphics.moveTo( 0, targetScaleRect.y + targetScaleRect.height );
target.graphics.lineTo( target.width, targetScaleRect.y + targetScaleRect.height );
target.graphics.moveTo( targetScaleRect.x + targetScaleRect.width, 0 );
target.graphics.lineTo( targetScaleRect.x + targetScaleRect.width, target.height );
}
}
}
i am calling Scale9Helper.setScaleGrid(GL.activeObject, 1);
from my main class.
GL.activeObject always will hold the current drawing rectangle.
NOTE that i am drawing the rectangle on mouse dragging event.
If any body have any idea about it please share it with me.

thanks in advance