Android および iOS 用の Flash Builder 4.5 でモバイル アプリケーションを作成しており、itemRenderer および iconitemrenderer クラスを使用して、アプリのオプションのリストを作成しています。何らかの理由で、それらをクリック可能にしたり、それぞれがクリックされたときに実行するアクションを定義したりできません。基本的に、私はFBの「ビュー」を使用して、アイテムをクリックすると新しいビューに切り替えることを目指しています. ここに私が取り組んでいるコードがあります:
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:ms="libs/MessageBox-digitalRetro">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:actionContent>
<s:Button id="signin" label="Sign in" click="onSignIn(event)"/>
</s:actionContent>
//code for the clicking of the sign in button
<fx:Script>
<![CDATA[
protected function onSignIn(event:Event):void
{
}
]]>
</fx:Script>
<s:List height="100%" width="100%">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer height="100" labelField="name"
iconField="photo" iconHeight="80"
iconWidth="80" messageFunction="getMessage">
<fx:Script>
<![CDATA[
import spark.components.NavigatorContent;
//this first method works
protected function getMessage(o:Object):String
{
return o.message;
}
]]>
</fx:Script>
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
<s:dataProvider>
<s:ArrayCollection>
<fx:Object name="Projects" photo="@Embed('libs/ProjectsIcon2.png')" message="Learn more about what we're working on" clickfn="views/Projects"/>
<fx:Object name="Locate Office" photo="@Embed('libs/google-maps-icon.png')" message="Find directions to our nearest office" clickfn=""/>
<fx:Object name="Contact Us" photo="@Embed('libs/gmailicon.png')" message="Let us know your thoughts!" clickfn=""/>
<fx:Object name="About Us" photo="@Embed('libs/info-icon.png')" message="" clickfn=""/>
</s:ArrayCollection>
</s:dataProvider>
<s:change>
<![CDATA[
// NEW!!!
var ClassReference:Class = getDefinitionByName(event.currentTarget.selectedItem.clickfn) as Class;
navigator.pushView(ClassReference);
]]>
</s:change>
</s:List>
</s:View>
編集:「変更」タグを追加しましたが、今はコンパイルされますが、エラーメッセージが表示されます:
ReferenceError: エラー #1065: 変数プロジェクトが定義されていません。global/flash.utils::getDefinitionByName() で views::MainHomeView/___MainHomeView_List1_change()[C:\Users\jlehenbauer\Adobe Flash Builder 4.5\Metters Inc\src\views\MainHomeView.mxml:56] で flash.events ::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core \UIComponent.as:13128] spark.components::List/commitSelection()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1205] で spark.components .supportClasses::ListBase/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\ListBase.as:939] spark.components::List/commitProperties() で[E:\dev\4.5.