ViewNavigator is basically used for navigating around different views, but is there a easier way to just restrict switching to any view and do some operation instead?
eg: I am viewing a product manual or help doc, and without going into any view i'd like to call customer care by clicking on a button in viewnavigator
code
<s:ViewNavigator id="navigatorHome" width="100%" height="100%"
elementAdd="viewAdded(event)" elementRemove="viewRemoved(event)"
icon="{Images.iconHome64}" firstView="{HomeView}">
<s:navigationContent>
<s:Button icon="{iconBack}" click="{navigatorHome.activeView.navigator.popView()}"/>
</s:navigationContent>
</s:ViewNavigator>
<s:ViewNavigator id="navigatorPhone" width="100%" height="100%"
elementAdd="viewAdded(event)" elementRemove="viewRemoved(event)"
icon="{iconPhone}" >
</s:ViewNavigator>
<s:ViewNavigator id="navigatorAlert" width="100%" height="100%"
elementAdd="viewAdded(event)" elementRemove="viewRemoved(event)"
icon="{iconAlerts}" firstView="{AlertView}">
</s:ViewNavigator>
<s:ViewNavigator id="navigatorSettings" width="100%" height="100%"
elementAdd="viewAdded(event)" elementRemove="viewRemoved(event)"
icon="{iconSettings}" firstView="{SettingsView}">
<s:navigationContent>
<s:Button icon="{iconBack}" click="{navigatorSettings.activeView.navigator.popView()}"/>
</s:navigationContent>
</s:ViewNavigator>
So here navigatorPhone
should not open any view, but instead call some function, Is there a way?
Update
I saw it here that there is a Removing event
so I got this
private function removing(event:ViewNavigatorEvent):void
{
trace("Inside removing event: "+event.currentTarget.name+", "+communicateViewCalled+", "+navigatorHome.activeView.name);
//event.preventDefault();
}
So here if anyhow I get to know the clicked view, it will do the trick. any help?
trace output by default I am on HomeView
and clicked CommunicateView
Inside removing event: HomeView, false, HomeView