我正在尝试选择一个textArea的id
<s:TextArea id="textarea1" focusIn="selectId(event)" />
selectId(event){
event.target.id;
}问题是TextArea是由RichEditableText组成的,所以target实际上并不是指TextArea。我已经尝试过event.target.parent.id,但仍然不能达到目的。有人知道怎么搞清楚这件事吗?
发布于 2010-06-17 19:12:33
应@Amargosh的要求,我将这篇文章作为答案发布。尝试:
event.currentTarget.id发布于 2010-06-17 14:37:59
<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
}https://stackoverflow.com/questions/3058523
复制相似问题