Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
Davide C #1
calling a popup by passing his name to a function
Hi! I'm new to Flex.
I have created with Flex 2 popups (which are TitleWindows):
popup1.mxml and popup2.mxml
Is there a way to write a function like this:
PHP Code:
public function openPopup(myPopup:String){
//here the code to take the string myPopup (which can be popup1 or popup2) and
create the popup...
??? I really don't know how to do this
PopupManager.createPopup (this, ???, true);
}
Thanks in advance.
Davide
Davide C Guest
-
Calling a function within a function registered to an event
Hey, Just registered and tried to search through the forum for a solution to my problem, but I haven't found anything that could help me. I've... -
Calling from ASP to .Net passing Recordset
Hi, I'm using a "classic" asp-page and a .net-component which I want to call passing a Recordset as a parameter. I have a reference to ADODB in... -
Passing a variable to a package function vs. a local function
I'm a bit new to this so please bear with me... I've written a script that uses CGI.pm something like this: use CGI::Carp qw(fatalsToBrowser);... -
Function calling from url
Good morning! I would like to call a function from a <FORM>'s ACTION attribute. This is what I'm trying to do: <FORM... -
Function/Global var to return name of calling function?
I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name... -
atta707 #2
Re: calling a popup by passing his name to a function
take a look at:
[url]http://www.onflex.org/ted/2007/11/creating-class-instances-dynamically.php[/url]
essentially you'll be using ApplicationDomain.currentDomain.getDefinition
method call as the second parameter to craetePopu method.
atta707 Guest
-
Davide C #3
Re: calling a popup by passing his name to a function
Thank you very much!
Davide
Davide C Guest
-
Davide C #4
Re: calling a popup by passing his name to a function
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?
Thanks.
Davide
Davide C Guest
-
atta707 #5
Re: calling a popup by passing his name to a function
So you have it working now?
atta707 Guest
-
Davide C #6
Re: calling a popup by passing his name to a function
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.getDefinitio n(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...
Davide C Guest
-
Davide C #7
Re: calling a popup by passing his name to a function
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...
Davide C Guest
-
Davide C #8
Re: calling a popup by passing his name to a function
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.
Davide C Guest
-
Davide C #9
Re: calling a popup by passing his name to a function
SOLVED!!!
The problem was this:
You have to specify the entire path to the MXML file:
hasDefinition("components.popups."+popUpName)
Now it works PERFECTLY!.
Davide C Guest
-
atta707 #10
Re: calling a popup by passing his name to a function
Thanks for sharing it back.
atta707 Guest
-
Davide C #11
Re: calling a popup by passing his name to a function
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?
Davide
Davide C Guest
-
-
Davide C #13
Re: calling a popup by passing his name to a function
[q]Originally posted by: ntsiii
Use modules.
Tracy[/q]
Hi Tracy,
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("pop ups.testModule") as Class;
var myPopup:TitleWindow =
TitleWindow(PopUpManager.createPopUp(this,myClass, true));
Davide
Davide C Guest



Reply With Quote

