 				else 
 				{
 					// Use either width or height based on the rotation
-					length = (rotation % 180) == 0 ? rc.width : rc.height;
+					length = (rotation % 180) == 0 ? bounds.width : bounds.height;
 				}
 	    	}
 	    	

	    	 
		    commonMatrix.rotate (!isNaN(_angle) ? _angle : rotationInRadians);
		    if (isNaN(tx))
		    	tx = rc.width / 2;
		    if (isNaN(ty))
		    	ty = rc.height / 2;
		    commonMatrix.translate(tx + rc.left, ty + rc.top);						 
		}
		else
		{
			commonMatrix.scale(rc.width / GRADIENT_DIMENSION, 1);
			commonMatrix.translate(rc.left + rc.width / 2, 0);
			commonMatrix.concat(compoundTransform.matrix);
		}			 
		


	//--------------------------------------------------------------------------
	//
	//
	//  Properties
	//
	//--------------------------------------------------------------------------

    //----------------------------------
	//  matrix
	//----------------------------------
    
    /**
     *  @private
     */
    override public function set matrix(value:Matrix):void
    {
    	scaleX = NaN;
    	super.matrix = value;
    }

	//----------------------------------
    //  scaleX
    //----------------------------------
    
    private var _scaleX:Number;
    
    [Bindable("propertyChange")]
    [Inspectable(category="General")]
    
    /**
     *  The horizontal scale of the gradient transform, which defines the width of the (unrotated) gradient
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */
    public function get scaleX():Number
    {
        return _scaleX; 
    }
    
    /**
     *  @private
     */
    public function set scaleX(value:Number):void
    {
        var oldValue:Number = _scaleX;
        if (value != oldValue && !compoundTransform)
        {
            _scaleX = value;
            dispatchGradientChangedEvent("scaleX", oldValue, value);
        }
    }

	//--------------------------------------------------------------------------
	//
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
