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