3 Replies Latest reply on May 15, 2009 10:11 PM by Lopo Nopo

    Dynamically loaded module completion?

    EhlersD

      In my main app I have this handler:

       

      private function loadAccessControl_Handler_READY(event:ModuleEvent):void
      {
           this.__acModule = __acInfo.factory.create() as IDRAppMgrModuleInterface;                        
           vb1.addChild(__acInfo.factory.create() as DisplayObject);

      }

       

      At this point, the module's creationComplete function hasn't been called yet; therefore, some internal variables are not ready to go.  Is there an easy existing way (without creating my own events, etc) for the application to be notified when the module has completed it's creation & setup?

       

      Thanks,

       

      Darren Ehlers

        • 1. Re: Dynamically loaded module completion?
          Flex harUI Adobe Employee

          Add a creationComplete handler to the module.

           

          BTW, pushing things down generally implies that you know more about the target than you should.  In a model/view architecture the module is typically the view and pulls things from the data model.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          1 person found this helpful
          • 2. Re: Dynamically loaded module completion?
            EhlersD Level 1

            Well, I am using the creationComplete handler in the Module itself, but that doesn't communicate it to the Application automatically.  Seems like I'll have to have the creationComplete handler in the module send a custom Event to the Application...

             

            BUT, your second comment:

             

            BTW, pushing things down generally implies that you know more about the target than you should.  In a model/view architecture the module is typically the view and pulls things from the data model.

             

            That one hits the mark!  I'm wanting the App to wait until the Module loads to then trigger an action.  BUT, the reality is that the Module itself should just trigger the action when it's ready.  There is no reason for the App to have to do that trigger.

             

            Thanks for making me see the light here!

             

            Darren

            • 3. Re: Dynamically loaded module completion?
              Lopo Nopo

              Hello EhlersD!

               

              That's EXACTLY what I've discussed about yesterday/today.

              Check on the forum here for a post by me concerning this issue.

               

              In short, you should addChild() and on the child you better use the "initialize" event - that's when you can access objects in your module.

               

              Regards!