flex mobile TabbedViewNavigatorApplication back bu

2019-09-08 06:22发布

问题:

Refer back to : flex mobile TabbedViewNavigatorApplication back button

I have 2 Tabs. Tab1 has 2 sub Views:

Tab1

Tab1subViewA

Tab1subViewB

Tab2

subview...

In Tab1 (Tab1SubViewA is the first View), -> I navigate to Tab1SubViewB (still under Tab1).

How can I go back to previous view (Tab1SubViewA)?

Note: it's not moving from Tab to Tab but moving from View to View all in the same Tab.

code for Tab1SubViewA:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="Tab1subViewA">

<s:Button click="{navigator.pushView(Tab1subViewB)}" />
</s:View>

code in TabbedViewNavigatorApplication:

...
<s:ViewNavigator firstView="views.Tab1subViewA" label="Page1" height="100%" width="100%" >
    <s:titleContent>
      <s:Button click="BackBtn(event)" label="Back"/>
    </s:titleContent>
  </s:ViewNavigator>

  <s:ViewNavigator firstView="views.Tab1subViewB"  label="Page2" height="100%" width="100%">
    <s:titleContent>
      <s:Button click="BackBtn(event)" label="Back"/>
    </s:titleContent>
  </s:ViewNavigator>

</s:TabbedViewNavigatorApplication>

回答1:

i found one simple way of doing it, just hard code it. If you really don't have a lot of views into each Tab (and mostly don't anyway), hard coding it is not that bad. Well, if anyone want to give a non-hard code solution to the above is welcome.