1 Reply Latest reply on Nov 10, 2009 11:43 AM by Flex harUI

    (Help) PopUpManager with States ......!!!!!!

    jabavox

      I have two MXML files (Main.mxml & PopWindow.mxml).

      The first one is Main.mxml,

      and I've already specified 3 states in it, including FirstPage, SecondPage, andThirdPage.

       

      For the script part of this Main.mxml, I also did something like this:

       

      <fx:Script>

       

              <![CDATA[
                  import mx.managers.PopUpManager;
      
                  private function doCreate():void {
                      var win:PopWindow = PopUpManager.createPopUp(this, PopWindow,  true) as PopWindow;
                      PopUpManager.centerPopUp(win);
                  }
              ]]>
       </fx:Script>
      and I add click="doCreate()" into the 'create' button that I specied in the 'FirstPage' state
      The second one is PopWindow.mxml,
      and I use TitleWindow with the two buttons, including 
      an ' ok ' button and a ' cancel ' button.
      

       

      For the 'ok' button, I set currentState="SecondPage"

      For the 'cancel' button, I set currentState="FirstPage"

       

      For the script part of this PopWindow.mxml, I also did something like this:

       

       

      <fx:Script>

       

            <![CDATA[

                 import mx.events.CloseEvent;

                 import mx.managers.PopUpManager;

       

            

                 private function titleWindow_close(evt:CloseEvent):void {

                      PopUpManager.removePopUp(this);

                 }

             ]]>

       

      </fx:Script>

       

       

      and also add close="titleWindow_close(event);" in the <mx:TitleWindow>

      for the window close button.

       

      After that I ran the files, I clicked on the ' create ' button at the FirstPage,

      and the popup title window appeared.

       

      **But the problem occurred after I click on the 'ok' button or the 'cancel' button.

      I got the error message stated that " Undefined state 'SecondPage' " or  "Undefined state 'FirstPage' " .

       

      ..Any help or suggestion for this ??

       

      In case if I can't use PopUpManager ,

      Is there the way like to let one state or component pop up inside another state,

      and still move back and forth between states ??

      Sorry....I'm quite new to flex, and this took me like 2 days already to work around with this.

      Thank you for spending your time reading / replying this topic...