 
         if (styleDeclaration && styleDeclaration.subject)
         {
-            decls = _subjects[styleDeclaration.subject];
+            decls = _subjects[styleDeclaration.subject] as Array;
             if (decls)
             {
                 for (i = 0; i < decls.length; i++)

     *  non-global class selector, pseudo selector).
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */ 
    public function hasAdvancedSelectors():Boolean
    {


    /**
     * @private
     * Determines whether at least one pseudo-condition has been specified for
     * the given state.
     */ 
    public function hasPseudoCondition(cssState:String):Boolean
    {
        return _pseudoCSSStates != null && _pseudoCSSStates[cssState] != null;
    }

    /**
     *  Retrieve all style declarations applicable to this subject. The subject
     *  is the right most simple type selector in a selector chain.
     * 
     *  @param subject The subject of the style declaration's selector.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */ 
    public function getStyleDeclarations(subject:String):Array // of CSSStyleDeclaration
    {
        // For Flex 3 and earlier, if we were passed a subject with a package
        // name, such as "mx.controls.Button", strip off the package name
        // leaving just "Button" and look for that subject.
        if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_0)
        {
            if (subject.charAt(0) != ".")
            {
                var index:int = subject.lastIndexOf(".");
                if (index != -1)
                    subject = subject.substr(index + 1);
            }
        }

        return _subjects[subject] as Array;
    }

    /**
     *  Gets the CSSStyleDeclaration object that stores the rules
     *  for the specified CSS selector.
     *
     *  <p>If the <code>selector</code> parameter starts with a period (.),
     *  the returned CSSStyleDeclaration is a class selector and applies only to those instances
     *  whose <code>styleName</code> property specifies that selector
     *  (not including the period).
     *  For example, the class selector <code>".bigMargins"</code>
     *  applies to any UIComponent whose <code>styleName</code>
     *  is <code>"bigMargins"</code>.</p>
     *
     *  <p>If the <code>selector</code> parameter does not start with a period,
     *  the returned CSSStyleDeclaration is a type selector and applies to all instances
     *  of that type.
     *  For example, the type selector <code>"Button"</code>
     *  applies to all instances of Button and its subclasses.</p>
     *
     *  <p>The <code>global</code> selector is similar to a type selector
     *  and does not start with a period.</p>
     *
     *  @param selector The name of the CSS selector.
     *
     *  @return The style declaration whose name matches the <code>selector</code> property.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */
    public function getStyleDeclaration(selector:String):CSSStyleDeclaration
    {
        // For Flex 3 and earlier, if we were passed a selector with a package
        // name, such as "mx.controls.Button", strip off the package name
        // leaving just "Button" and look for that type selector.
        if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_0)
        {
            if (selector.charAt(0) != ".")
            {
                var index:int = selector.lastIndexOf(".");
                if (index != -1)
                    selector = selector.substr(index + 1);
            }
        }

        return _selectors[selector];
    }

    /**
     *  Sets the CSSStyleDeclaration object that stores the rules
     *  for the specified CSS selector.
     *
     *  <p>If the <code>selector</code> parameter starts with a period (.),
     *  the specified selector is a class selector and applies only to those instances
     *  whose <code>styleName</code> property specifies that selector
     *  (not including the period).
     *  For example, the class selector <code>".bigMargins"</code>
     *  applies to any UIComponent whose <code>styleName</code>
     *  is <code>"bigMargins"</code>.</p>
     *
     *  <p>If the <code>selector</code> parameter does not start with a period,
     *  the specified selector is a "type selector" and applies to all instances
     *  of that type.
     *  For example, the type selector <code>"Button"</code>
     *  applies to all instances of Button and its subclasses.</p>
     *
     *  <p>The <code>global</code> selector is similar to a type selector
     *  and does not start with a period.</p>
     *
     *  @param selector The name of the CSS selector.
     *  @param styleDeclaration The new style declaration.
     *  @param update Set to <code>true</code> to force an immediate update of the styles.
     *  Set to <code>false</code> to avoid an immediate update of the styles in the application.
     *  The styles will be updated the next time this method or the <code>clearStyleDeclaration()</code> method
     *  is called with the <code>update</code> property set to <code>true</code>.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 9
     *  @playerversion AIR 1.1
     *  @productversion Flex 3
     */
    public function setStyleDeclaration(selector:String,
                                styleDeclaration:CSSStyleDeclaration,
                                update:Boolean):void
    {
        // Populate the selectors Array for this style declaration
        styleDeclaration.selectorRefCount++;
        _selectors[selector] = styleDeclaration;

        // We also index by subject to help match advanced selectors
        var subject:String = styleDeclaration.subject;
        if (subject != null)
        {
            var declarations:Array = _subjects[subject] as Array;
