2/9/2010 5:02:10 AM
Title:
passing values
how to pass value from one window(parent) to another window(child) and vice versa.
HELP PLEASE
2/9/2010 5:37:15 AM
are you taking about passing data between different windows of AIR application or the windows inside an flex application?
2/9/2010 7:46:49 AM
i need to know in adobe air application how to pass values between windows
2/9/2010 11:43:56 AM
Suppose your parent window in AIR is crating a window like this :
private var myWin:MyWindow;
private function openWin():void
{
myWin = new MyWindow();
myWin.title = "New Window Adobe AIR!";
myWin.maximizable=false;
myWin.open();
}
Now you can use "myWin" refrence to call any function declared in the new window to pass on variables etc.
for e.g your child window is already having a function called "recieveVariables" then you can use the myWin.recieveVariables(var1,var2,var3) to send variables and communicate.
2/9/2010 9:05:43 PM
hi Brig
In ur example it is accessing child class attributes but what if i want to access parent attribute or parent in child window.
help please
2/10/2010 12:18:16 AM
Hi that's quite simple, from any popup window use
Application.application to refer to your main application window.
you can access public functions and variables from main Adode AIR Window as :
Application.application.methodOnParent();
2/10/2010 1:35:44 AM
hi Taylor
i am writing open() on button click event on popup window(TitleWindow),here i want to access main application(WindowedApplication) attribute or function but ur code is not working.
public function open():void
{
if(txtpsw.text=="bmc" && cmbname.text=="bmc")
{
PopUpManager.removePopUp(this);
//Application.application.mainapplicationfunction();
}
else
{ mx.controls.Alert.show("Incorrect login","Wrong Login");
txtpsw.text="";
cmbname.text="";
}
}
Help Please.thanks in advance
2/10/2010 1:57:03 AM
you have called code after removing "this" popup which means remove me , it will stop execution of any code after this line for current component.
try putting application code before line
PopUpManager.removePopUp(this);
you can also verify from flex debugger whether the particular line was executed or not.
2/10/2010 2:13:17 AM
have you included the class
import mx.core.Application;
I have checked the code by simply calling a parent function on button click and it works fine. Also make sure your function in main application is public.
It should appear in code hint when writing Application.application.
2/10/2010 2:43:21 AM
hey it worked
thanks a ton