0

I am working on a Flex 4.6 Mobile project and am trying to use a list to navigate views from a menu view that has been set up.

I'm finding tutorials from Adobe, but most involve changing to the same view and just altering data based on which list item you clicked. What I am actually trying to do is , depending on which list item you click on, you get a unrelated view pushed in, different views completely per list item. Also, did I go about this the wrong way? I understand there are many different ways to navigate the views, with buttons, tabs, etc. But this is something that has been asked for. Example of my current list:

    <s:List id="toolsList" x="10" y="284" width="255" height="197" borderVisible="false"
        color="black" downColor="#00764C" fontSize="16" fontWeight="bold"
        skinClass="view.skins.ListSkin" verticalScrollPolicy="off">
    <s:itemRenderer>
        <fx:Component>  
            <renderers:StyledIconItemRenderer labelField="label" iconField="icon"/>
        </fx:Component>
    </s:itemRenderer>       
    <s:ArrayCollection>
        <fx:Object label="Settings" icon="@Embed('resources/arrow.png')"/>
        <fx:Object label="Fault Current Search" icon="@Embed('resources/arrow.png')"/>
        <fx:Object label="Share Picture" icon="@Embed('resources/arrow.png')"/>
        <fx:Object label="System Info" icon="@Embed('resources/arrow.png')"/>
    </s:ArrayCollection>    
</s:List>

So, based on above example I would like to click on the "Settings" list item and get my settings view, then when I "pop" the settings view, I will go back to the menu and if I click the "Share Picture" list item, then I get that specific view, and so forth.

I am not really asking anyone to write code for me here, but maybe even point me in the right direction of a online example that maybe I haven't found yet.

Thank you in advance for any consideration

4

1 回答 1

1

如果您在ArrayCollection应该导航到的视图中的每个项目上存储一些数据,那么您可以为读取此数据并推送适当视图的列表编写一个更改事件处理程序。

例如,添加每个项目应转到的视图的完全限定类名:

<s:ArrayCollection>
    <fx:Object label="Settings" icon="@Embed('resources/arrow.png')" viewClass="com.whatever.SettingsClass/>
    ...
</s:ArrayCollection>

然后在列表中添加一个点击处理程序:

<s:List id="theList" change="onSelectedItemChange()" />

private function onSelectedItemChange():void
{
    var className:String = theList.selectedItem.viewClass;
    var viewClass:Class = getDefinitionByName(className) as Class;
    ViewNavigatorApplication.navigator.pushView(viewClass);
}
于 2013-06-13T20:27:01.453 回答