     {
         return _scaleMode;
     }
-    
+
     /**
      *  @private
      */
     public function set scaleMode(value:String):void
     {
-        if (value == _scaleMode) 
+        if (value == _scaleMode)
             return;
-        
+
         _scaleMode = value;
         invalidateDisplayList();
     }
-    
+
     //----------------------------------
     //  smooth
     //----------------------------------
-    
+
     private var _smooth:Boolean = false;
-    
-    [Inspectable(category="General", enumeration="true,false", defaultValue="false")]   
-    
+
+    [Inspectable(category="General", enumeration="true,false", defaultValue="false")]
+
     /**
      *  @copy flash.display.GraphicsBitmapFill#smooth
      *
      *  @default false
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5

    private var previousUnscaledHeight:Number;
    private var sourceInvalid:Boolean;
    private var loadFailed:Boolean;
	
    //----------------------------------
    //  bitmapData
    //----------------------------------
    
    private var _bitmapData:BitmapData;
    
    /**
     *  Returns a copy of the BitmapData object representing 
     *  the currently loaded image content (unscaled).  This property
     *  is <code>null</code> for untrusted cross domain content.
     * 
     *  @default null
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.0
     *  @productversion Flex 4.5
     */
    public function get bitmapData():BitmapData 
    {
        return _bitmapData ? _bitmapData.clone() : _bitmapData; 
    }
    
    //----------------------------------
    //  bytesLoaded
    //----------------------------------
    
    private var _bytesLoaded:Number = NaN;
    
    /**
     *  The number of bytes of the image already loaded.
     *  Only relevant for images loaded by request URL. 
     * 
     *  @default NaN
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.0
     *  @productversion Flex 4.5
     */
    public function get bytesLoaded():Number 
    {
        return _bytesLoaded; 
    }
    
    //----------------------------------
    //  bytesTotal
    //----------------------------------
    
    private var _bytesTotal:Number = NaN;
    
    /**
     *  The total image data in bytes loaded or pending load. 
     *  Only relevant for images loaded by request URL. 
     * 
     *  @default NaN
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.0
     *  @productversion Flex 4.5
     */
    public function get bytesTotal():Number 
    {
        return _bytesTotal; 
    }
    
    //----------------------------------
    //  clearOnLoad
    //----------------------------------
    
    private var _clearOnLoad:Boolean = true;
    
    /**
     *  Denotes whether or not to clear previous 
     *  image content prior to loading new content.
     * 
     *  @default true
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 2.0
     *  @productversion Flex 4.5
     */
    public function get clearOnLoad():Boolean 
    {
        return _clearOnLoad; 
    }
    
    /**
     *  @private
     */

            isNaN(_scaleGridLeft) ||
            isNaN(_scaleGridRight))
        {
            var sampledScale:Boolean = _smooth &&
                (_smoothingQuality == BitmapSmoothingQuality.HIGH) &&
                (_fillMode == BitmapFillMode.SCALE);
            var sampleWidth:Number = fillWidth;
            var sampleHeight:Number = fillHeight;
            
            if (isZoom)
            {
                sampleWidth = _bitmapData.width * fillScaleX;
                sampleHeight = _bitmapData.height * fillScaleY;
            }

            var b:BitmapData = sampledScale ? resample(_bitmapData, sampleWidth, sampleHeight) : _bitmapData;

            if (sampledScale && (_fillMode == BitmapFillMode.SCALE))
            {
                if (isZoom)
                {
                    fillScaleX = fillScaleY = 1;
                }
                else if (_fillMode == BitmapFillMode.SCALE)
                {
                    fillScaleX = adjustedWidth / b.width;
                    fillScaleY = adjustedHeight / b.height;
                }
            }
            
            var cHeight:Number = b.height * fillScaleX;
            var cWidth:Number = b.width * fillScaleY;

            // Align our bitmap content as necessary if our width
            // and/or height is larger than our content height.
            if (maintainAspectRatio || _fillMode == BitmapFillMode.CLIP || isZoom)
            {
                if (unscaledHeight > cHeight)
                    roundedDrawY = roundedDrawY + Math.floor((unscaledHeight - cHeight)
                        * getVerticalAlignValue());

                if (unscaledWidth > cWidth)
                    roundedDrawX = roundedDrawX + Math.floor((unscaledWidth - cWidth)
                        * getHorizontalAlignValue());
            }
            
            var translateX:Number = roundedDrawX;
            var translateY:Number = roundedDrawY;
            
            if (isZoom)
            {
                if (cWidth > unscaledWidth)
                    translateX = translateX + ((unscaledWidth - cWidth) * getHorizontalAlignValue());
                else if (cHeight > unscaledHeight)
                    translateY = translateY + ((unscaledHeight - cHeight) * getVerticalAlignValue());
            }

            matrix.identity();
            if (!(sampledScale && (maintainAspectRatio || isZoom))) 
                matrix.scale(fillScaleX, fillScaleY);
            matrix.translate(translateX, translateY);
            g.beginBitmapFill(b, matrix, repeatBitmap, _smooth);
            g.drawRect(roundedDrawX, roundedDrawY, fillWidth, fillHeight);
            g.endFill();
        }
        else
        {
            // If we have scaleGrid, we draw 9 sections, each with a different scale factor based
            // on the grid region.

            if (cachedSourceGrid == null)
            {
                // Generate the 16 points of the source (unscaled) grid
                cachedSourceGrid = [];
                cachedSourceGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
                    new Point(_scaleGridRight, 0), new Point(_bitmapData.width, 0)]);
                cachedSourceGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
                    new Point(_scaleGridRight, _scaleGridTop), new Point(_bitmapData.width, _scaleGridTop)]);
                cachedSourceGrid.push([new Point(0, _scaleGridBottom), new Point(_scaleGridLeft, _scaleGridBottom),
                    new Point(_scaleGridRight, _scaleGridBottom), new Point(_bitmapData.width, _scaleGridBottom)]);
                cachedSourceGrid.push([new Point(0, _bitmapData.height), new Point(_scaleGridLeft, _bitmapData.height),
                    new Point(_scaleGridRight, _bitmapData.height), new Point(_bitmapData.width, _bitmapData.height)]);
            }

            if (cachedDestGrid == null ||
                previousUnscaledWidth != unscaledWidth ||
                previousUnscaledHeight != unscaledHeight)
            {
                // Generate teh 16 points of the destination (scaled) grid
                var destScaleGridBottom:Number = unscaledHeight - (_bitmapData.height - _scaleGridBottom);
                var destScaleGridRight:Number = unscaledWidth - (_bitmapData.width - _scaleGridRight);
                cachedDestGrid = [];
                cachedDestGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
                    new Point(destScaleGridRight, 0), new Point(unscaledWidth, 0)]);
                cachedDestGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
                    new Point(destScaleGridRight, _scaleGridTop), new Point(unscaledWidth, _scaleGridTop)]);
                cachedDestGrid.push([new Point(0, destScaleGridBottom), new Point(_scaleGridLeft, destScaleGridBottom),
                    new Point(destScaleGridRight, destScaleGridBottom), new Point(unscaledWidth, destScaleGridBottom)]);
                cachedDestGrid.push([new Point(0, unscaledHeight), new Point(_scaleGridLeft, unscaledHeight),
                    new Point(destScaleGridRight, unscaledHeight), new Point(unscaledWidth, unscaledHeight)]);
            }

            var sourceSection:Rectangle = new Rectangle();
            var destSection:Rectangle = new Rectangle();

            // Iterate over the columns and rows. We draw each of the nine sections at a calculated
            // scale and translation.
            for (var rowIndex:int=0; rowIndex < 3; rowIndex++)
            {
                for (var colIndex:int = 0; colIndex < 3; colIndex++)
                {
                    // Create the source and destination rectangles for the current section
                    sourceSection.topLeft = cachedSourceGrid[rowIndex][colIndex];
                    sourceSection.bottomRight = cachedSourceGrid[rowIndex+1][colIndex+1];

                    destSection.topLeft = cachedDestGrid[rowIndex][colIndex];
                    destSection.bottomRight = cachedDestGrid[rowIndex+1][colIndex+1];

                    matrix.identity();
                    // Scale the bitmap by the ratio between the source and destination dimensions
                    matrix.scale(destSection.width / sourceSection.width, destSection.height / sourceSection.height);
