Check out how we wrote mx.controls.Alert.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kgnytia
Sent: Tuesday, May 29, 2007 1:33 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] PopUpManager

 

Hi all!

Im trying to open a "client form" pop up from another form. This is 
the code im using in the parent.

public var pop : Client; /*this is the class that is to be created 
for the popup: Client.mxml*/

private function selectClient() : void{ 
pop = PopUpManager.createPopUp(this,Client,true) as 
Client; 
pop["dataGridClients"].addEventListener
("itemClick",getClient); 
}

private function getClient(event : ListEvent):void {
if (event.rowIndex > 0){ 
/*the name of the client is shown in a label*/
lblClientName.text = 
(pop.dataGridClients.selectedItem as Client).name;
/*the popup window is closed*/
removeMe(event);
}
}

private function removeMe(event:Event):void {
PopUpManager.removePopUp(pop);
}

This works ok but since i may have to repeat this code many times in 
order to open the "client form" pop up from many places i would like 
to know if there is any other way of doing this. 

Something like: 
In the parent: 
Client.getClient(this) 
and then in the Client: 
public static function obtenerComunidad(parent) : ComunidadAutonoma
{
var pop : Client = PopUpManager.createPopUp(parent,Client,true) as 
Client; 
}

Thank you very much! 

 

Reply via email to