FLEX simple question ...help !

Affichage des 6 messages de 6 personnes.
Message n° 1
1 réponse
Remi a écritle 19 janvier 2008 à 10:33
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 :)
Message n° 2
Johan a écritle 29 janvier 2008 à 14:18
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
Message n° 3
Elias a répondu à : message de Remile 10 mars 2008 à 03:36
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
Message n° 4
Nizar a écritle 7 mai 2009 à 01:43
this doesn't see to work at all
can you please illustrate in an example
Message n° 5
Debra a écritle 4 novembre 2009 à 05:00
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
Message n° 6
Roua a écritle 5 novembre 2009 à 13:30
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.