6 Replies Latest reply on Jul 17, 2008 2:27 PM by *gsb*

    Creating modal modules?

    yantzgh Level 1
      I'm trying to use a single module loader to create dynamically loaded modal modules. The modules that are loaded are dynamic in that the path to the module is passed as a parameter (retrieved via XML depending on user level, etc.).

      I've tried using the PopUpManager, but it fails because the path to the module is passed as a String data-type as oppose to a Class data-type.

      I've tried porting some of the code from the PopUpManager class to create a FocusManager for the module itself, but I get errors with that as well.

      So, is there a way to load these modules and make them modal? If so, how can it be accomplished?

      Thanks,
      Greg
        • 1. Re: Creating modal modules?
          EDendramis Level 1
          I am not sure 100% what you are trying to do, but I *think* what you want is "getDefinitionByName()". It's a flash.util. If you look for "getDefinitionByName" in the Flex docs then you should find what you're looking for.

          Using that you can use the PopUpManager because you will be able to pass it as a Class instead of a string

          example:

          var ClassReference:Class = getDefinitionByName("flash.display.Sprite") as Class;
          • 2. Re: Creating modal modules?
            yantzgh Level 1
            That sounds exactly like what I'm looking for, but I get a variable not defined error on the following line (I've written out the full path to the module for testing purposes)...

            var modClass:Class = getDefinitionByName("modules.engage.mission") as Class;

            ...If I pass modules.engage.mission as a Class directly to the PopUpManager, it creates the pop-up, so the class does exist.

            Strange...
            • 3. Re: Creating modal modules?
              EDendramis Level 1
              I Think you need to import the definition.

              Did you try import modules.engage.mission?
              • 4. Re: Creating modal modules?
                yantzgh Level 1
                Yup, I had the import there. Same error.

                Is there a way for the variable in the XML file to be read as a class as oppose to a string when I'm parsing it?

                Alternatively, I suppose I could do something like the following. It would just make it hard coded (and there a lot of modules)...
                • 5. Re: Creating modal modules?
                  yantzgh Level 1
                  I was over complicating the situation. Instead of opening the specific module class with the PopUpManager, all I needed to do was open a ModuleLoader and then load the desired module into the loader.
                  • 6. Re: Creating modal modules?
                    *gsb* Level 1
                    I did something similar I believe.

                    It uses both the PopupManager and the ModuleManager and is 'state-based.' That is, for each state change, the PopupManager removes the last module, if any, and loads a new one based on the new state. The module is presented both centered and modal.

                    In my case I made a simple PopupModuleBase class (.as) like:
                    public class PopupModuleBase extends Box
                    so my modules can be simple MXML SWFs: you could use other than a box, but I found the box best for my application.

                    Anyway, if you are still struggling and would like to discuss it further, let me know.