7 Replies Latest reply on Sep 2, 2011 11:30 AM by SinetDannyUtah

    TabbedViewNavigatorApplication Issue

    SinetDannyUtah

      When clicking on a tab in the application that is currently the selected tab I am returned to what appears to be the first view of that tab. Having dived a little deeper I am finding that it dosent just return me to the first view but rather it creates another instance of that view and pushes it onto the stack everytime the tab is pushed. I am finding that this only happens when the ViewNavigator has multiple states and is not in the default state and the tab is clicked but also when another ViewNavigator is pushed and then the ViewNavigator for which the state was changed previously is returned too.

       

      I am finding nothing on the web with others having this problem and would appreciate any feedback anybody may have as to a work around or solution, thanks

        • 1. Re: TabbedViewNavigatorApplication Issue
          SinetDannyUtah Level 1

          Update: after having started a new test project and attempting to replicate this issue I am finding the problem to be a view being pushed from a ViewNavigator once this has been done and the user attempts to push the tab to return to the original ViewNavigator a new instance of the viewNavigator is created and pushed onto the stack, after just a few of these as you can imagin with heavy views the memory is through the roof.

           

          I will report back my finding but does anyone have input?

          • 2. Re: TabbedViewNavigatorApplication Issue
            Shongrunden Adobe Employee

            Can you post the code of your main application file?

            • 3. Re: TabbedViewNavigatorApplication Issue
              SinetDannyUtah Level 1

              <?xml version="1.0" encoding="utf-8"?>

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

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

                creationComplete="handler_creationComplete()" splashScreenImage="@Embed(source='assets/images/splash.png')" splashScreenScaleMode="none" splashScreenMinimumDisplayTime="2000">

              <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

              </fx:Declarations>

               

              <fx:Script>

              <![CDATA[

              import dao.core.ClientPersonnel;

              import dao.core.ContentAbbrev;

              import dao.core.ContentSrch;

              import dao.core.Licenses;

               

              import framework.AppRAMM;

               

              import mx.core.IVisualElement;

              import mx.events.FlexEvent;

               

              import spark.events.IndexChangeEvent;

               

              import views.BrowseView;

              import views.HistoryView;

              import views.SearchView;

              import views.SettingsView;

              import views.VideoDetailsView;

               

              internal var __typeImport_ContentAbbrev:ContentAbbrev;

              internal var __typeImport_ClientPersonnel:ClientPersonnel;

              internal var __typeImport_Licenses:Licenses;

              internal var __typeImport_ContentSrch:ContentSrch;

               

              public var closeTimer:Timer;

               

              private function handler_creationComplete():void

              {

              removeEventListener(FlexEvent.CREATION_COMPLETE, handler_creationComplete);

              tabbedNavigator.tabBar.visible = false;

               

              NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivateApp);

              NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onActivate);

               

              AppRAMM.ramm.addEventListener("loggedOut",cleanupViewOnLogout_Handler);

               

              }

              protected function onDeactivateApp(event:Event):void

              {

              //The user has 1 hrs. or 3600000 millisecs. to come back to the application before the timer is called and the app is shut down completley

              closeTimer = new Timer(3600000,1);

              closeTimer.addEventListener(TimerEvent.TIMER_COMPLETE,closeApp);

              closeTimer.start();

              }

              protected function closeApp(event:Event):void

              {

              if(NativeApplication.nativeApplication.timeSinceLastUserInput >= 36000)

              {

              NativeApplication.nativeApplication.exit();

              }

              }

               

              protected function onActivate(event:Event):void

              {

              closeTimer = null;

              }

              protected function cleanupViewOnLogout_Handler(event:Event):void

              {

              NativeApplication.nativeApplication.addEventListener(Event.TAB_INDEX_CHANGE,eventHandlerFo rTabbar);

              tabbedNavigator.selectedIndex = 0;

              /* historyView.popAll();

              historyView.firstView = HistoryView;

              searchView.popAll();

              searchView.firstView = SearchView; */

              historyView.popToFirstView();

              searchView.popToFirstView();

              }

               

              protected function eventHandlerForTabbar(event:Event):void

              {

              tabbedNavigator.tabBar.visible = false;

              NativeApplication.nativeApplication.removeEventListener(Event.TAB_INDEX_CHANGE,eventHandle rForTabbar);

               

              }

               

              ]]>

              </fx:Script>

              <fx:Style source="assets/styles/main.css"/>

              <s:ViewNavigator id="browseView" label="Browse" width="100%" height="100%" firstView="views.BrowseView" icon="@Embed('assets/icons/nav_videos.png')"/>

              <s:ViewNavigator id="searchView" label="Search" width="100%" height="100%" firstView="views.SearchView" icon="@Embed('assets/icons/nav_search.png')"/>

              <s:ViewNavigator id="historyView" label="History" width="100%" height="100%" firstView="views.HistoryView" icon="@Embed('assets/icons/nav_history.png')"/>

              <s:ViewNavigator id="settingsView" label="Settings" width="100%" height="100%" firstView="views.SettingsView" icon="@Embed('assets/icons/nav_admin.png')"/>

               

               

              </s:TabbedViewNavigatorApplication>

              This is the main file to the application, I also broke this problem out to a small test project to replicate the problem and is happening there as well

              • 4. Re: TabbedViewNavigatorApplication Issue
                Shongrunden Adobe Employee

                Can you please provide that small test application so we can investigate further?

                • 5. Re: TabbedViewNavigatorApplication Issue
                  SinetDannyUtah Level 1

                  How can I upload the file?

                  • 6. Re: TabbedViewNavigatorApplication Issue
                    Shongrunden Adobe Employee

                    I believe you can attach files if you send me a private message.

                     

                    Or hopefully your code is as minimal as possible and you could paste it here directly.

                     

                    Something like


                    Main.mxml:

                        CODE

                     

                    View.mxml:

                     

                        CODE

                    • 7. Re: TabbedViewNavigatorApplication Issue
                      SinetDannyUtah Level 1

                      I have actually discovered that it was a problem with our code and not a problem with the way the flex sdk was handling the objects thanks for trying to help