This content has been marked as final. Show 3 replies
Well, I don't think you can use a TextInput as a global variable as I suppose you intend to. What I mean is that if you use it in five places thoroughout your app, and you set the text property, it will have the same property in all places.
If that is what you want, then just declare it in AS in your main app. Outside the main app you can refer to it as Application.application.txt. You will need to import mx.core.Application.
Really you should just create individual instances as necessary, unless they should truely represent the same instance.
"Hashashino" <firstname.lastname@example.org> wrote in message
> Hi all,
> I am new to flex and I have a problem with global variable. My
> is to take TextInput variable and make it a global variable. This is
> because I
> have a lot of components and I need the variable to be used across the
> pages. I
> am aware of the global variable from Mike Chambers tutorial stated below:
It sounds like you actually want the text property of a TextInput to _feed_
a global variable. Try something like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
public var foo:String ;
<mx:TextInput id="username" width="118" x="83" y="10"
Also check out
Many thanks to Greg Lafrance and Amy Blankenship for helping me out.