 
     public override function set scale9Grid(innerRectangle:Rectangle):void
     {
-        _scale9Grid = innerRectangle;
+        _scale9Grid = innerRectangle && _bitmapData ?
+              clampRect(innerRectangle, _bitmapData.rect)
+            : innerRectangle;
         uvsNeedRecalc = vertsNeedRecalc = true;
         invalidate();
     }

        return _indicesCorners;
    }

    private static function bitmapsSameSize(a:BitmapData, b:BitmapData):Boolean
    {
        return a && b && a.width == b.width && a.height == b.height;
    }
}
}


    public function set bitmapData(new_bitmapData:BitmapData):void
    {
        _bitmapData = new_bitmapData;
        scale9Grid = _scale9Grid;
        invalidate();
    }

