4 Replies Latest reply on Jun 12, 2010 9:10 AM by Davdi1982

    States, From Flash to Flex!

    Davdi1982

      Hi - I'm new of Flex.

       

      I have see that if i select Flex SDk 3.5 or ADOBE SDK (i want to build Extensions for Illustrator) than i can create State nested in other State.

       

      State 1

          State 1.1

          State 1.2

      State 2

          State 2.1

          State 2.2

              State 2.3

       

      Instead, If i select Flex 4 SDK i can't nested an State inside other State.

       

      Basically, i want to create an Application that can be in 3 State.

       

      Login

         - Success

         - Failed

      Admin

         - CreateUser

         - EditUser

         - ManageUser

      User

        - CreateProfile

        - EditProfile

        - GetProfile

       

      What is the best method in order to do That?

       

      In flash:

      3 MovieClip, every movie have 'n' frame ... or 1 MovieClip for every "SCREEN" and i create it dinamically with new .... and addChild.

       

      In Flash is Easy for me ... But in Flex? :-)

       

      da.

        • 1. Re: States, From Flash to Flex!
          David_F57 Level 5

          hi,

           

          What you do is create your application with the 3 states login, Admin, User,

           

          Theses state each include a form/page

           

          login.mxml

            has 2 states - Success, fail

          Admin.mxml

          has 3 states - create, edit , manage

          User.mxml

          has 3 states - create, edit, get

           

          If you want each of those states could be in their own mxml.

           

          http://gumbo.flashhub.net/wizard/  source included.

           

          This is a very basic 3 state application each state in its own mxml file. It Will give you an idea of states controling 'pages'.

           

          David.

          1 person found this helpful
          • 2. Re: States, From Flash to Flex!
            Davdi1982 Level 1

            Hi - Thanks you.

             

            I'm in LOGIN_PANEL and i want to get reference of a TEST_PANEL (created by me).

             

                     protected function button1_clickHandler(event:MouseEvent):void
                        {
                            // TODO Auto-generated method stub
                           
                            var myB:Browserstyle_Navigation = this.parentDocument as Browserstyle_Navigation;
                            trace(myB.name+"_"); // trace - Browserstyle_Navigation0_
                            trace(myB.mytestPanel); trace - null
                        }

             

            In the Browserstyle_Navigation.MXML:

                <s:states>
                    <s:State name="LoginPanel"/>
                    <s:State name="EntryPanel"/>
                    <s:State name="ResultPanel"/>
                    <s:State name="TestPanel"/>
                </s:states>

             

                <ns1:test_pnl name="myTestPanel2" id="myTestPanel" includeIn="TestPanel" horizontalCenter="0" verticalCenter="0">
                </ns1:test_pnl>

             

            :-)

             

            DA.

            • 3. Re: States, From Flash to Flex!
              David_F57 Level 5

              hi,

               

              With states they only get instantiated when they are displayed if you want to send something to a state or read a value in it you need to set its creationpolicy to all so that it is initialised at the beginning instead of when it is displayed.

               

               

              David.

              1 person found this helpful
              • 4. Re: States, From Flash to Flex!
                Davdi1982 Level 1

                flash_builder.PNG

                With this example, i want show you that when i work with Illustrator SDK (inside Flash Builder) i can create state inside other state.

                Why i can't do it with a normal Flash Builder Project? :-)

                 

                DA.