3 Replies Latest reply on Feb 4, 2010 11:00 AM by Flex harUI

    Can a module unload itself?

    Scott R. Hamilton Level 1

      I would like to be able to load a module that returns a

      value to its calling module or applications and then

      unloads itself.

       

      I cannot find an example in the documentation of this being

      done although it seems that this would be a typical sort of

      thing that developers would want to be able to do.

       

      Scott

        • 1. Re: Can a module unload itself?
          Flex harUI Adobe Employee

          Module loading is asynchronous so you can't "return" something.  If the

          module class has a method on it that you call the in the ready handler of

          the loading app you would call factory.create() then the method and as long

          as you didn't store the instance anywhere permanent it would be garbage

          collected at some point and the module would unload

          • 2. Re: Can a module unload itself?
            Scott R. Hamilton Level 1

            Hi Alex,

             

            what I would like to do is load a module that allows the user to enter

            filter criteria and then select records in the data base.

             

            He/she then marks one of the retrieved records in a datagrid and

            presses a "Select" button.

             

            The filter/select module should write the record key of the selected

            record back to the calling module and control should return to the

            calling module.

             

            I should be able to use the parentApplication specifier to write

            the data to a field in the caller. But when I try to get the the

            called module to unload using:

             

            parentApplication.TargetModule.url = null;

             

            both modules get unloaded.

             

             

            Scott

            • 3. Re: Can a module unload itself?
              Flex harUI Adobe Employee

              Hard to say what the problem is.  Remember that parentApplication is not the

              same as "parent module".  Make sure you have a strong reference from the

              main app to the calling module otherwise it might be that the filter module

              is the only thing preventing the calling module from being garbage

              collected.  Also check the code that loads modules to make sure you are

              using the applicationDomain parameters correctly.