0 Replies Latest reply on May 26, 2012 1:19 AM by ProcessEndNow

    using currentTarget.label as variable in path?

    ProcessEndNow Level 1

      I have the following code:

       

      <s:FormItem label="First" click="onItemFocus(event)">

            <s:TextInput id="First" enabled="false" text="some text here..."/>

      </s:FormItem>

       

      Which when you click the FormItem it fires this function:

       

      protected function onItemFocus(e:MouseEvent):void

         {

          var targetname:String = e.currentTarget.label;

           First.enabled = true;

           First.setFocus();

           First.selectAll();

         }

       

      Now as you can see the targetname variable value is 'First' and the ID of the textfield is 'First' so the next part of the question is, how do I use the targetname variable as the name of the component I wish to enable?

       

      I was advised that I could do it with square brackets like:

       

      [targetname]enabled = true; but I can't make that work, and as I have about 50 fields that need this setting an efficient way would be great.

       

      The other possibility I have is if I can set a style for the the normal state, and then a different style for the normal w/focus??? Now that would be awsome as this would alow tabbing between fields too, which would be better under certain circumstances.

       

       

      Thanks for any help you can provide.

       

      Shaine