Skip to main content
Zeloslaw
Known Participant
December 19, 2012
Question

popView() problem - reset navigator views - iPad

  • December 19, 2012
  • 1 reply
  • 1501 views

Hi.

I am creating an multiscreen application on iPada3.
I use a stack of views with the class navigator pushView () and popView (). When I switch to another app on my iPad, and then go back to my application, the navigator is reset and popView () shows incorrect previous view.


Example:
I am on 5 view my application. I switch to another application such as Photo Booth, and then go back to my application and I click back (popView()) to return to the previous view. Shows a view of 2 or 1 instead of 4. How does it protect? Tested AIR 3.5 and 3.6 beta.

This topic has been closed for replies.

1 reply

Inspiring
December 20, 2012

Hi,

In your ViewNavigatorApplication, use persistNavigatorState="true" like this:

<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     persistNavigatorState="true" ...

For more information, see:

Understanding Flex Mobile View and ViewNavigator

http://corlan.org/2011/01/12/understanding-flex-mobile-views-and-viewnavigator/

and

Flex 4.5 (Hero) - Persistant Data in MobileApplication

http://custardbelly.com/blog/2010/11/15/flex-hero-persistant-data-in-mobileapplication/

Philippe

Zeloslaw
ZeloslawAuthor
Known Participant
December 20, 2012

Thank you for the information Phil, but unfortunately persistNavigatorState = "true" does not work on my iPad 3.
popView () still does not return to the previous view.

Perhaps I should use navigatorStateSaving and navigatorStateLoading, but how to detect that I switch to another application?

Zeloslaw
ZeloslawAuthor
Known Participant
December 21, 2012

Problem solved!

That was my mistake. I put the listener buttons in a statement viewActivate = viewActivateHandler ().

Every time when I switch between views other apps, caused another listener. Thus, he is the problem.

private function viewActivateHandler(event:ViewNavigatorEvent):void

{

      // BUTTONS LISTENER

     backBtn = new SwipeAndTap(backButton);

     backBtn.addEventListener(TouchEventTap.TAP, backButtonTapHandler);

}

In this case, we need to remember viewDeactivate and remove listener.