2 Replies Latest reply on Oct 22, 2010 1:07 PM by MikisMM

    How to show progress bar or spinner while navigating page through view stack?

    erdravi

      Hi

       

           I'm having a main page(main.mxml) in that i defined viewstack to load child pages(pageone.mxml and pagetwo.mxml). In pageone.mxml i'm having a button triggered to change the stack index in main.mxml. My problem is, pagetwo.mxml having more components so that its taking long time to load. How to show progress bar or spinner to the user while loading pagetwo.mxml?

       

      Thanks

        • 1. Re: How to show progress bar or spinner while navigating page through view stack?
          jfb00 Level 3

          Hi,

          One way is to setup a init function to fire at the time of calling the component.

          Inside is init funciton you can set to call a progress bar component like:

          private function init():void{

                  var loadingPopUpView:Class = LoadingPopUpView;
                  popUpWindow = PopUpManager.createPopUp(this,loadingPopUpView,false);
                  PopUpManager.centerPopUp(popUpWindow);

          }

           

          Where loadingPopUpView is your custom component loadingPopUpView.mxml :

          <?xml version="1.0" encoding="utf-8"?>
          <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" cornerRadius="6" alpha="1" height="60" width="220"
          horizontalAlign="center" verticalAlign="middle" title="Loading...">
              <mx:ProgressBar indeterminate="true" height="10" trackHeight="10" width="160"
                         barColor="#326CB4" label=" "/>
          </mx:TitleWindow>

           

          Johnny

          Please rate answers.

          • 2. Re: How to show progress bar or spinner while navigating page through view stack?
            MikisMM

            There is one small problem, however. Your spinner won't spin, because while creating components, flex won't redraw the display, won't fire timer events - it will freeze. So instead of the spinner I suggest a label with a text like "Loading. Please wait...". You can use a popup window, as jfb00 posted previously and put that that label in it.

             

            Michael