This content has been marked as final. Show 6 replies
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
var ClassReference:Class = getDefinitionByName("flash.display.Sprite") as Class;
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.
I Think you need to import the definition.
Did you try import modules.engage.mission?
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)...
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.
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.