1 Reply Latest reply on Feb 22, 2009 11:52 PM by drillnaut

    Bind Hidden Data to Text Input

    Web Magi Level 4
      Hi,

      I am looking for a way to bind hidden data (number strings) to text fields, so that when a button is clicked the text fields get automatically populated with the hidden data.

      This is what I have:

      <mx:Script>
      <![CDATA[

      // Adding Hidden Numbers to Text Input Fields on Click Event

      [Bindable(event="getNumbers")]
      private var _boundText1:String = "123456";
      private var _boundText2:String = "78910";

      private function updateInfo():void
      {
      dispatchEvent(new Event("getNumbers"));
      }
      ]]>
      </mx:Script>

      But the script is automatically placing the numbers in the text input fields, and not waiting for the click event "updateInfo()".

      Is there an easy solution that I'm missing?

      Thanks
        • 1. Re: Bind Hidden Data to Text Input
          drillnaut
          Um okay, your code is kind of confusing. Here's how I would do it. When ever you want to set the text fields to the magical strings you either use a function or an event. Lets assume we have 2 textfields name textfield_1 and textfield_2.

          public function someEvent(event:Event):void
          {
          textfield_1.text = var _boundText1;
          textfield_2.text = var _boundText2;
          }