views:

33

answers:

2

I'm trying to select the id of a textArea when it's focused in

<s:TextArea id="textarea1" focusIn="selectId(event)" />

selectId(event){
   event.target.id;
}

Problem is TextArea is made up of RichEditableText so target doesn't actually refer to TextArea. I've tried event.target.parent.id but still not getting there. Anyone knows how to get to the bottom of this?

+1  A: 
<s:TextArea id="textarea1" focusIn="selectId(event,this.textarea1)" />

private function selectId(event, item) : void
{
   // Your code to do stuff with item
}

In fact, you don't need to send the event argument at all if you aren't going to use it:

<s:TextArea id="textarea1" focusIn="selectId(this.textarea1)" />

private function selectId(item) : void
{
   // Your code to do stuff with item
}
John Drummond
+2  A: 

At @Amargosh's request, I'm posting this as an answer. Try:

event.currentTarget.id
Robusto