         // Call this method on each non-visual StyleClient
         if (advanceStyleClientChildren != null)
         {
-            var nAdvanceStyleChildern:int = advanceStyleClientChildren.length;
-            for (var j:int = 0; j < nAdvanceStyleChildern; j++)
+            for (var styleClient:Object in advanceStyleClientChildren)
             {
-                if (advanceStyleClientChildren[j].inheritingStyles !=
+                var iAdvanceStyleClientChild:IAdvancedStyleClient = styleClient
+                    as IAdvancedStyleClient;
+                
+                if (iAdvanceStyleClientChild && 
+                    iAdvanceStyleClientChild.inheritingStyles !=
                     StyleProtoChain.STYLE_UNINITIALIZED)
                 {
-                    advanceStyleClientChildren[j].regenerateStyleCache(recursive);
+                    iAdvanceStyleClientChild.regenerateStyleCache(recursive);
                 }
             }
         }
-
-    }
-
+    }
     /**
      *  This method is called when a state changes to check whether
      *  state-specific styles apply to this component. If there is a chance


        if (advanceStyleClientChildren != null)
        {
            var nAdvanceStyleChildern:int = advanceStyleClientChildren.length;
            for (var j:int = 0; j < nAdvanceStyleChildern; j++)
            {
                var iAdvanceStyleClientChild:IFlexModule = advanceStyleClientChildren[j] as IFlexModule;
                if (!iAdvanceStyleClientChild)
                    continue;

                if (iAdvanceStyleClientChild.moduleFactory == null 
                    || iAdvanceStyleClientChild.moduleFactory == _moduleFactory)
                {
                    iAdvanceStyleClientChild.moduleFactory = factory;
                }
            }
        }

        _moduleFactory = factory;

        setDeferredStyles();

    /**
     *  @private
     */
    mx_internal var advanceStyleClientChildren:Dictionary = null;

    /**
     *  Adds a non-visual style client to this component instance. Once 
