0
CodeIgniterを使用してPHPスクリプトを使用してデータベースから画像をロードしていますが、これらの画像を使用するイベントハンドラを追加しようとすると、エラー: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」をドロップ(その他の機能)を許可する必要があります。
ありがとうございます!
EDIT:次のように定義された
cloneCar方法:
private function cloneCar(e:MouseEvent):void
{
// do stuff
}
あなたは 'cloneCarを定義している:「awqは」言ったように、
ItemRenderer
スコープはグローバルスコープとは独立しているので、私はouterDocument
ディレクティブを使用してpublic
とmouseDownイベントで、それへのリンクとしての私のイベントハンドラ関数を宣言する必要があります) 'メソッドの中で、あなたの' itemRenderer''コンポーネントの内部か、それとも外ですか? 'itemRenderer'の外で定義した場合、すべて正常です。エラーが発生します。 'ItemRenderer'は「全く異なるファイル」のようなものなので、オブジェクトを継承したり、オブジェクトを作成したり、静的メソッドを持たない限り、他のファイルメソッドにアクセスすることはできません。 – randomUser56789