以下に定義されているmyIconFunction内でapp.mxmlで定義されているグローバル変数を使用することは可能ですか?
<s:List id="list" x="7" y="10" width="463" height="661"
creationComplete="list_creationCompleteHandler(event)" labelField="name" click="list_clickHandler(event)">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer labelField="name"
iconFunction="myIconFunction"
decorator="@Embed(source='assets/images/general/arrow_next.jpg')"
iconWidth="50"
iconHeight="50">
<fx:Script>
<![CDATA[
private function myIconFunction(item:Object):String
{
return "http://localhost/mydatapath/" + item.imagelink;
// how to use this.parentApplication.dataPath here
}
]]>
</fx:Script>
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
parentApplication.dataPath変数は、サーバーのIPを格納します。アプリケーションのいくつかの場所で同様の機能を使用しているため、ローカルホストから実際のサーバーに移動するときに、すべての場所でIPを変更する必要があります。使用する
this.parentApplication.dataPath + item.imagelink
コンパイル時エラーが発生します。それで、そのような関数内で外部/グローバル変数を使用することは可能ですか?