0
我正在通过CodeIgniter使用PHP脚本从数据库加载一些图像,但是当我尝试添加事件处理程序以使用这些图像做一些事情时,Flex编译器向我展示了一个错误:事件处理程序与Flex中的DataGrid行相关联
1180: Call to a possibly undefined method cloneCar.
为什么我不能在此上下文中添加事件处理程序?
<mx:Accordion>
<mx:Form id="menu5" label="Prueba" width="100%" height="100%" backgroundColor="#707070" icon="{roadIcon}">
<mx:DataGrid x="251" y="95" dataProvider="{traffic_signals.lastResult..signal}"
showHeaders="false"
horizontalGridLines="false"
selectionColor="#707070"
themeColor="#707070"
alternatingItemColors="[#707070, #707070]"
borderColor="#707070"
rollOverColor="#707070">
<mx:columns>
<mx:DataGridColumn dataField="source" >
<mx:itemRenderer >
<mx:Component >
<mx:Image width="94" height="94" mouseDown="cloneCar(event)"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Form>
</mx:Accordion>
没有mouseDown
句子,一切工作正常,但我需要让拖“N”这些图像下降(和其他功能)。
谢谢!
编辑:这样定义
cloneCar方法:
private function cloneCar(e:MouseEvent):void
{
// do stuff
}
你上哪儿去定义你的'cloneCar( )'方法,在你的'itemRenderer's'组件内还是外面?如果你在'itemRenderer'之外定义了它,那么一切都是正常的,它应该会抛出错误。 'ItemRenderer'就像“完全不同的文件”,所以除非你继承或创建对象或者有静态方法,否则你不能访问其他文件方法。 – randomUser56789 2012-01-17 10:22:35