Skip navigation
ProcessEndNow
Currently Being Moderated

using currentTarget.label as variable in path?

May 26, 2012 1:19 AM

Tags: #flash_builder #as3 #flex #4.5 #actionscript #skin #style

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

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points