This content has been marked as final. Show 12 replies
take a look at:
essentially you'll be using ApplicationDomain.currentDomain.getDefinition method call as the second parameter to craetePopu method.
Thank you very much!
Just another question about this:
I implemented the popup as a mxml component in the drectory src/popups/pop_login.mxml. And "hasDefinition" doesn't seem to work in that case...Is there a way to do that WITHOUT implementing the popup as a class?
So you have it working now?
Not yet.., I mean: what I have now is:
var login:pop_login=pop_login(PopUpManager.createPopUp( this, pop_login , true));
where pop_login is a component. I don't know how, but Flex seem to find it and use it as a class. But if I do the same thing this way:
var thePop:Class = Class(ApplicationDomain.currentDomain.getDefinition(popUpName));
where popUpName is the filename (without extension) of the component (pop_login.mxml , in the dir src/popups/) that I pass as string, the function returns always false...
Sorry, I'm new to Flex, maybe it is a bit confused...
No, I tried but it does not work. I don't know how to do this with mxml components. it seems that
ApplicationDomain.currentDomain.hasDefinition always returns false...
What I need is just a sort of "Factory Pattern" where, according to what I pass as a string, it instantiates the class with that name.
The problem was this:
You have to specify the entire path to the MXML file:
Now it works PERFECTLY!.
Thanks for sharing it back.
Just another NOTE:
The code above works ONLY if you reference the classes somewhere in the code. I mean:
public var: popLogin:pop_login; and so on...
This is not good at all.
So my question is: how you can REFERENCE (not import) an entire set of classes (components, actually) in a project? The "import" directive, since it is a compile directive, is not enough...
Originally posted by: ntsiii
it does not work...maybe I'm missing something, but I have created a module and tried to load (as popup) dinamically...but the result is the same. I have to reference it before doing that:
public var myModule:TestModule; //This is what I would like to AVOID.
then I can use this:
var myClass:Class = ApplicationDomain.currentDomain.getDefinition("popups.testModule") as Class;
var myPopup:TitleWindow = TitleWindow(PopUpManager.createPopUp(this,myClass,true));