      *  Storage for the old related property values, if used.
      */
     private var oldRelatedValues:Array;
+    
+    /**
+     *  @private
+     *  Flag which tracks if we're actively overriding a style.
+     */
+    private var applied:Boolean = false;
+    
+    /**
+     *  @private
+     *  Our most recent parent context.
+     */
+    private var parentContext:UIComponent = null;
 
     //--------------------------------------------------------------------------
     //

     */
    public function apply(parent:UIComponent):void
    {
        var obj:IStyleClient = target ? target : parent;
        var relatedProps:Array = RELATED_PROPERTIES[name] ?
                                 RELATED_PROPERTIES[name] :
                                 null;

        // Remember the current value so it can be restored
        oldValue = obj.getStyle(name);

        if (relatedProps)
        {
            oldRelatedValues = [];

            for (var i:int = 0; i < relatedProps.length; i++)
                oldRelatedValues[i] = obj[relatedProps[i]];
        }

        // Set new value
        if (value === null)
        {
            obj.clearStyle(name);
        }
        else if (oldValue is Number)
        {
            // The "value" for colors can be several different formats:
            // 0xNNNNNN, #NNNNNN or "red". We can't use
            // StyleManager.isColorStyle() because that only returns true
            // for inheriting color styles and misses non-inheriting styles like
            // backgroundColor.
            if (name.toLowerCase().indexOf("color") != -1)
                obj.setStyle(name, StyleManager.getColorName(value));
            else
                obj.setStyle(name, Number(value));
        }
        else if (oldValue is Boolean)
        {
            obj.setStyle(name, toBoolean(value));
        }
        else
        {
            obj.setStyle(name, value);
        }
    }

    /**
     *  @inheritDoc
     */
    public function remove(parent:UIComponent):void
    {
        var obj:IStyleClient = target ? target : parent;

        // Restore the old value
        if (oldValue is Number)
            obj.setStyle(name, Number(oldValue));
        else if (oldValue is Boolean)
            obj.setStyle(name, toBoolean(oldValue));
        else if (oldValue === null)
            obj.clearStyle(name);
        else
            obj.setStyle(name, oldValue);


        var relatedProps:Array = RELATED_PROPERTIES[name] ?
                                 RELATED_PROPERTIES[name] :
                                 null;

        // Restore related property values, if needed
        if (relatedProps)
        {
            for (var i:int = 0; i < relatedProps.length; i++)
            {
                obj[relatedProps[i]] = oldRelatedValues[i];
            }
        }
    }


     * 
     *  @default null
     */
    public var target:Object;

    //----------------------------------
    //  value
