FLEX simple question ...help !

Displaying all 6 posts by 6 people.
Post 1
1 reply
Remi wroteat 10:33 on 19 January 2008
Hi ,
How can i get a simple variable located on root.mxml (MAIN PROJECT) from another MXML file ?

I have for example :

var userID:String = "asdzxc" in root.mxml
and i want to get this value from login.mxml

I am a noob :)
Post 2
Johan wroteat 14:18 on 29 January 2008
the easiest way is to create a public variable in login.mxml (or perhaps a read-only value), and use the following for referencing to it:

idOfLoginInstance.nameOfVariable
Post 3
Elias replied to Remi's postat 03:36 on 10 March 2008
you can create a public instance method on a root.mxml to return userID variable like this:

root.mxml
----------
var userID:String = "asdzxc"
public function get usrId():String{
return userID;
}

and on the other file login.mxml
u can call that method from root.mxml

e.g:
login.mxml
-----------------

import mx.core.Application;
var userID:String = Application.application.root.usrId;


Hope that will help chess
Post 4
Nizar wroteat 01:43 on 07 May 2009
this doesn't see to work at all
can you please illustrate in an example
Post 5
Debra wroteat 05:00 on 04 November 2009
I am also a noob, and messed with this question myself for a long time. I found that if you import mx:core.Application, you can then access the variable with the following format: Application.application.varname

HTH,

Deb
Post 6
Roua wroteat 13:30 on 05 November 2009
Hostel RouaDeMunte ( Mountain Dew) is situated in Herculane SPA,in a quiet area with a beautiful landscape and offers oasis of relaxation and serenity that you need at any time of year.