选择TextArea的id(尽管RichEditableText)

时间:2010-06-17 02:27:32

标签: flex actionscript-3 adobe mxml

我正在尝试选择textArea的id,当它集中在

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

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

问题TextAreaRichEditableText组成,因此target实际上并未引用TextArea。我已经尝试了event.target.parent.id但仍然没有到达那里。任何人都知道如何深入了解这一点?

2 个答案:

答案 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
}
相关问题