5 Replies Latest reply on Jun 29, 2010 6:23 AM by DB_Shonek

    StyleProtoChain.as Error loading a module

    DB_Shonek

      Hi, im having problems loading a module in flex 4, it previously works fine in flex 3 and other modules are working fine right now.

       

      This is how im loading the modules (the same for all them):

       

      MyModuleContainer = new moduleContainer;

      viewstack2.addChild(MyModuleContainer);

      MyModuleContainer.miModuleLoader.url = ThisResource.url;

      MyModuleContainer.miModuleLoader.loadModule();

      MyModuleContainer.name = String(ResourceID);

       

      This is my moduleContainer component:

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%" initialize="init()">

           <fx:Script>

                <![CDATA[

                     import mx.controls.ProgressBar;

                     import mx.events.ModuleEvent;

       

       

                     private var MyProgressBar:ProgressBar = new ProgressBar;

       

       

                     private function init():void{

                          addChild(MyProgressBar);

                          MyProgressBar.source = miModuleLoader;

                          MyProgressBar.percentWidth = 50;

                          MyProgressBar.setStyle("verticalCenter", 0);

                          MyProgressBar.setStyle("horizontalCenter", 0);

                          miModuleLoader.addEventListener(ModuleEvent.READY, onComplete);

                     }

                     private function onComplete(event:ModuleEvent):void {

                          removeChild(MyProgressBar);

                     }

                ]]>

           </fx:Script>

           <mx:ModuleLoader x="0" y="0" width="100%" height="100%" id="miModuleLoader">

           </mx:ModuleLoader>

      </mx:Canvas>

       

      The full error:

       

      TypeError: Error #1009: No se puede acceder a una propiedad o a un método de una referencia a un objeto nulo.

      at mx.styles::StyleProtoChain$/initProtoChainForUIComponentStyleName()[E:\dev\4.0.0\framewor ks\projects\framework\src\mx\styles\StyleProtoChain.as:356]

      at mx.styles::StyleProtoChain$/initProtoChain()[E:\dev\4.0.0\frameworks\projects\framework\s rc\mx\styles\StyleProtoChain.as:171]

      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::initProtoChain()[E:\dev\4.0.0\frameworks\proje cts\framework\src\mx\core\UIComponent.as:10186]

      at mx.core::UIComponent/regenerateStyleCache()[E:\dev\4.0.0\frameworks\projects\framework\sr c\mx\core\UIComponent.as:10249]

      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\4.0.0\frameworks\projects \framework\src\mx\core\UIComponent.as:7114]

      at mx.core::UIComponent/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UI Component.as:6811]

      at mx.controls.listClasses::ListBase/createChildren()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\controls\listClasses\ListBase.as:3774]

      at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]

      at modules.reports::reportsTree/initialize()

      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\UIComponent.as:7142]

      at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\Container.as:3951]

      at mx.core::Container/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Co ntainer.as:2616]

      at mx.core::Container/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Cont ainer.as:2534]

      at mx.core::Container/createComponentFromDescriptor()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\core\Container.as:4371]

      at mx.core::Container/createComponentsFromDescriptors()[E:\dev\4.0.0\frameworks\projects\fra mework\src\mx\core\Container.as:4160]

      at mx.core::Container/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\Container.as:3187]

      at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]

      at mx.core::Container/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Co ntainer.as:3129]

      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\UIComponent.as:7142]

      at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\Container.as:3951]

      at mx.core::Container/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Co ntainer.as:2616]

      at mx.core::Container/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Cont ainer.as:2534]

      at mx.core::Container/createComponentFromDescriptor()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\core\Container.as:4371]

      at mx.core::Container/createComponentsFromDescriptors()[E:\dev\4.0.0\frameworks\projects\fra mework\src\mx\core\Container.as:4160]

      at mx.core::Container/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\Container.as:3187]

      at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\ UIComponent.as:7250]

      at mx.core::Container/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Co ntainer.as:3129]

      at modules.reports::reports/initialize()

      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\UIComponent.as:7142]

      at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\ framework\src\mx\core\Container.as:3951]

      at mx.core::Container/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Co ntainer.as:2616]

      at mx.core::Container/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Cont ainer.as:2534]

      at mx.modules::ModuleLoader/moduleReadyHandler()[E:\dev\4.0.0\frameworks\projects\framework\ src\mx\modules\ModuleLoader.as:468]

      at flash.events::EventDispatcher/dispatchEventFunction()

      at flash.events::EventDispatcher/dispatchEvent()

      at ModuleInfoProxy/moduleEventHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\mo dules\ModuleManager.as:1168]

      at flash.events::EventDispatcher/dispatchEventFunction()

      at flash.events::EventDispatcher/dispatchEvent()

      at ModuleInfo/readyHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\modules\Modul eManager.as:812]

      at flash.events::EventDispatcher/dispatchEventFunction()

      at flash.events::EventDispatcher/dispatchEvent()

      at mx.core::FlexModuleFactory/update()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\cor e\FlexModuleFactory.as:433]

      at mx.core::FlexModuleFactory/docFrameHandler()[E:\dev\4.0.0\frameworks\projects\framework\s rc\mx\core\FlexModuleFactory.as:582]

      at mx.core::FlexModuleFactory/docFrameListener()[E:\dev\4.0.0\frameworks\projects\framework\ src\mx\core\FlexModuleFactory.as:126]

      Any help would be nice, thanks in advance.