     mx_internal var _angle:Number;
     
     [Inspectable(category="General")]
-	[Deprecated(replacement="rotation")]
+    [Deprecated(replacement="rotation")]
     /**
      *  By default, the LinearGradientStroke defines a transition
      *  from left to right across the control. 

     */
    public function set matrix(value:Matrix):void
    {
    	var oldValue:Matrix = matrix;
    	
    	var oldX:Number = x;
    	var oldY:Number = y;
    	var oldRotation:Number = rotation;
    	
    	if (value == null)
    	{
    		compoundTransform = null;
    		x = NaN;
    		y = NaN;
    		rotation = 0;
    	}	
    	else
    	{
	    	// Create the transform if none exists. 
	    	if (compoundTransform == null)
	            compoundTransform = new CompoundTransform();
	       	compoundTransform.matrix = value; // CompoundTransform will create a clone
	       	
	       	dispatchGradientChangedEvent("x", oldX, compoundTransform.x);
	       	dispatchGradientChangedEvent("y", oldY, compoundTransform.y);
	       	dispatchGradientChangedEvent("rotation", oldRotation, compoundTransform.rotationZ);
	    }
    }
    
    //----------------------------------

                _y = value;                
            }
                
            dispatchGradientChangedEvent("y", oldValue, value);
        }
    }
    
    mx_internal function get rotationInRadians():Number
    {
        return rotation / 180 * Math.PI;
    }

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

    /**
     *  @private
     *  Extract the gradient information in the public <code>entries</code>
     *  Array into the internal <code>colors</code>, <code>ratios</code>,
     *  and <code>alphas</code> arrays.
     */
    private function processEntries():void
    {
        colors = [];
        ratios = [];
        alphas = [];

        if (!_entries || _entries.length == 0)
            return;

        var ratioConvert:Number = 255;

        var i:int;
        
        var n:int = _entries.length;
        for (i = 0; i < n; i++)
        {
            var e:GradientEntry = _entries[i];
            e.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, 
                               entry_propertyChangeHandler, false, 0, true);
            colors.push(e.color);
            alphas.push(e.alpha);
            ratios.push(e.ratio * ratioConvert);
        }
        
        if (isNaN(ratios[0]))
            ratios[0] = 0;
            
        if (isNaN(ratios[n - 1]))
            ratios[n - 1] = 255;
        
        i = 1;

        while (true)
        {
            while (i < n && !isNaN(ratios[i]))
            {
                i++;
            }

            if (i == n)
                break;
                
            var start:int = i - 1;
            
            while (i < n && isNaN(ratios[i]))
            {
                i++;
            }
            
            var br:Number = ratios[start];
            var tr:Number = ratios[i];
            
            for (var j:int = 1; j < i - start; j++)
            {
                ratios[j] = br + j * (tr - br) / (i - start);
            }
        }
    }

    /**
     *  Dispatch a gradientChanged event.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */
    mx_internal function dispatchGradientChangedEvent(prop:String,
                                                      oldValue:*, value:*):void
    {
        dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, prop,
                                                            oldValue, value));
    }

    //--------------------------------------------------------------------------
    //
    //  Event handlers
    //
    //--------------------------------------------------------------------------

    /**
     *  @private
     */
    private function entry_propertyChangeHandler(event:Event):void
    {
        processEntries();

        dispatchGradientChangedEvent("entries", entries, entries);
    }
}

}
