FLEX simple question ...help !

Mostrando las 6 publicaciones de 6 personas.
Comentario nº 1
1 respuesta
Remi ha escritoEl 19 de enero de 2008 a las 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 :)
Comentario nº 2
Johan ha escritoEl 29 de enero de 2008 a las 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
Comentario nº 3
Elias ha respondido a la publicación de RemiEl 10 de marzo de 2008 a las 3: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
Comentario nº 4
Nizar ha escritoEl 07 de mayo de 2009 a las 1:43
this doesn't see to work at all
can you please illustrate in an example
Comentario nº 5
Debra ha escritoEl 04 de noviembre de 2009 a las 5: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
Comentario nº 6
Roua ha escritoEl 05 de noviembre de 2009 a las 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.