我正在尝试选择textArea的id,当它集中在
时<s:TextArea id="textarea1" focusIn="selectId(event)" />
selectId(event){
event.target.id;
}
问题TextArea
由RichEditableText
组成,因此target
实际上并未引用TextArea
。我已经尝试了event.target.parent.id
但仍然没有到达那里。任何人都知道如何深入了解这一点?
答案 0 :(得分:3)
在@ Amargosh的要求下,我将此作为答案发布。尝试:
event.currentTarget.id
答案 1 :(得分:1)
<s:TextArea id="textarea1" focusIn="selectId(event,this.textarea1)" />
private function selectId(event, item) : void
{
// Your code to do stuff with item
}
事实上,如果您不打算使用它,则根本不需要发送事件参数:
<s:TextArea id="textarea1" focusIn="selectId(this.textarea1)" />
private function selectId(item) : void
{
// Your code to do stuff with item
}