开发者

Selecting id of TextArea (despite RichEditableText)

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

<s:TextArea id="textarea1" focusIn="selectId(even开发者_StackOverflow中文版t)" />

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?


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

event.currentTarget.id


<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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜