我有以下代码:
<mx:Repeater id="showNames" dataProvider="{parentApplication.bfa1aStudents}">
<mx:Text text="{parentApplication.getStudentName(showNames.currentItem)}" color="#8ab534" click="nameSelected(Number(showNames.getRepeaterItem(showNames.currentIndex)));" selectable="false" mouseOver="parentApplication.switchCursor(true);" mouseOut="parentApplication.switchCursor(false);" />
</mx:Repeater>
我知道你不能在点击时使用currentItem或currentIndex。。。这个问题已经用getRepeaterItem()函数解决了,但我不确定如何使用它。DP是一堆数字,如果重要的话,代表用户ID。如果有人能帮我完成文本中的"点击"部分,我将不胜感激。
尝试event.currentTarget.getRepeaterItem()
进行点击,而不是showNames
尝试将Text组件包装在VBox中。正如JAX所说,您可能还需要考虑解决其他一些问题。
尝试:
event.currentTarget.selectedItem.data
在您的单击处理程序中。