3 Replies Latest reply on Nov 3, 2008 6:13 PM by Hashashino

    Making a global variable out of TextInput

    Hashashino
      Hi all,
      I am new to flex and I have a problem with global variable. My intent 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:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      public var foo:String = "bar";
      ]]>
      </mx:Script>
      </mx:Application>

      So, my problem is actually to take this TextInput variable and pass it to the actionscript above so that I can make it global.

      <mx:TextInput id="username" width="118" x="83" y="10"/>

      Below are non-functional codes I attempted:

      public var nricG:String = username;

      public var nricG:String = {username};

      public var nricG:String = username.text;

      Sincerely hope that someone out there could help. Thank you.