2 Replies Latest reply on Apr 17, 2007 2:11 PM by tfiff

    HistoryManager errors with ModuleLoader?

    tfiff
      Hi,
      My app uses Modules. The main module includes an Accordion.
      I can load the accordion module fine and then unload it. But when I attempt to load it the second time I get the error below. I have tried disabling history management from the accordion by specifying: historyManagementEnabled="false" but I then get a shorter error (see error 2 below). I still get error 1 with history removed from the app. Is this error actually related to historymanager or something else?

      Thanks
      Steve

      Error 1
      =====

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::HistoryManager$/register()
      at mx.containers::Accordion/::addedHandler()
      at flash.display::DisplayObjectContainer/addChildAt()
      at mx.core::UIComponent/ http://www.adobe.com/2006/flex/mx/internal::$addChildAt()
      at mx.core::Container/addChildAt()
      at mx.core::Container/addChild()
      at mx.core::Container/createComponentFromDescriptor()
      at mx.core::Container/createComponentsFromDescriptors()
      at mx.core::Container/mx.core:Container::createChildren()
      at mx.core::UIComponent/initialize()
      at mx.core::Container/initialize()
      at com.Modules::AdminLeftModule/initialize()
      at mx.core::UIComponent/ http://www.adobe.com/2006/flex/mx/internal::childAdded()
      at mx.core::Container/ http://www.adobe.com/2006/flex/mx/internal::childAdded()
      at mx.core::Container/addChildAt()
      at mx.core::Container/addChild()
      at mx.modules::ModuleLoader/::moduleReadyHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at ::ModuleInfoProxy/::moduleEventHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at ::ModuleInfo/readyHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::FlexModuleFactory/::update()
      at mx.core::FlexModuleFactory/::docFrameHandler()

      Error 2
      ======
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::HistoryManager$/unregister()
      at mx.containers::Accordion/mx.containers:Accordion::commitProperties()
      at mx.core::UIComponent/validateProperties()
      at mx.managers::LayoutManager/::validateProperties()
      at mx.managers::LayoutManager/::doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/::callLaterDispatcher2()
      at mx.core::UIComponent/::callLaterDispatcher()
        • 1. Re: HistoryManager errors with ModuleLoader?
          cluebcke
          No guarantees that I can help, but first check this thread on flexcoders if you haven't already:

          http://tech.groups.yahoo.com/group/flexcoders/message/64096

          And this relevant quote, which apparently originated from an unnamed engineer at Adobe. Here he's/she's suggesting that this problem can occur when a manager class is loaded by a module instead of the top-level application; when this happens, other modules (or the application) see that the class has already been loaded, but are unable to instantiate it because the class definition exists in the module it was first referenced in, which is not visible to the other modules or application. Or something like that; it's still a bit foggy to me.

          quote:


          The simple solution is to link the DragManager into the main application by putting something like this in a script block [in the main application]

          import mx.managers. DragManager;
          var dm:DragManager;

          This fattens your application a little. More complex solutions involve loading the DragManager into the main application' s application domain.



          Obviously this is about DragManager, not HistoryManager, but the conversation (though it started with HistoryManager) became about managers in general.

          Anyway, here's hoping that helps a little,
          Chris
          • 2. Re: HistoryManager errors with ModuleLoader?
            tfiff Level 1
            Thanks for your reply.
            I put the following at the top of my app and repeated module unloading and loading work without errors:
            import mx.managers.HistoryManager;
            private var hm:HistoryManager;

            Thanks again
            Steve