7 Replies Latest reply on Jan 26, 2009 4:57 PM by Newsgroup_User

    View States

    istrasci

      In working w/ view states in Flex, it seems that they are laid out only hierarchically... I'm wondering if there is a way to have "disjoint" (for lack of better/correct terminology) state models in Flex...

      My example is the following... I have four (4) states: "open" and "closed" which are correlated, and "up" and "down" which are correlated... But each pair has nothing to do with the other... The state graph would look like this:
      ("open" <---> "closed") . . . . disjoint . . . . ("up" <---> "down")
      These pairs are basically to show/hide some components, like the login/register example...

      Is there any way to model disjoint graphs, or am I gonna have to create the four (4) related states, "upOpen", "upClosed", "downOpen", and "downClosed" and model them like:

      upOpen <---> upClosed
      ^....................................^
      |.....................................|
      V...................................V
      downOpen <---> downClosed

      Obviously this approach is not optimal, because the number of "combined" states will grow exponentially (2 ^ <number_of_pairs>) when adding more show/hide pairs and make an N-cube of transitions... Please tell me it is possible to do disjoint state graphs in Flex...!
        • 1. Re: View States
          Level 7

          "istrasci" <webforumsuser@macromedia.com> wrote in message
          news:glde2g$dn5$1@forums.macromedia.com...
          > In working w/ view states in Flex, it seems that they are laid out only
          > hierarchically... I'm wondering if there is a way to have "disjoint" (for
          > lack
          > of better/correct terminology) state models in Flex...
          >
          > My example is the following... I have four (4) states: "open" and
          > "closed"
          > which are correlated, and "up" and "down" which are correlated... But
          > each
          > pair has nothing to do with the other... The state graph would look like
          > this:
          > ("open" <---> "closed") . . . . disjoint . . . . ("up" <---> "down")
          > These pairs are basically to show/hide some components, like the
          > login/register example...
          >
          > Is there any way to model disjoint graphs, or am I gonna have to create
          > the
          > four (4) related states, "upOpen", "upClosed", "downOpen", and
          > "downClosed" and
          > model them like:
          >
          > upOpen <---> upClosed
          > ^....................................^
          > |.....................................|
          > V...................................V
          > downOpen <---> downClosed
          >
          > Obviously this approach is not optimal, because the number of "combined"
          > states will grow exponentially (2 ^ <number_of_pairs>) when adding more
          > show/hide pairs and make an N-cube of transitions... Please tell me it is
          > possible to do disjoint state graphs in Flex...!

          I think this is being added in Gumbo


          • 2. Re: View States
            John Hall Level 4
            I can't say I'm sure I'm tracking what you're asking but it sounds like you could do what you want with one state, two states or four states. Kind of depends upon how many objects you have to hide and show based upon the state. Are there simply a few things that differ amongst all the states? Or is there a lot of object's visibility that differ?
            • 3. Re: View States
              istrasci Level 1
              quote:

              Originally posted by: John Hall
              I can't say I'm sure I'm tracking what you're asking but it sounds like you could do what you want with one state, two states or four states. Kind of depends upon how many objects you have to hide and show based upon the state. Are there simply a few things that differ amongst all the states? Or is there a lot of object's visibility that differ?


              Each pair of states affects the visibility of a different set of components... So, say state "open" shows component one, and "closed" shows components 1 and 2; "up" shows 3 and 4, and "down", 3, 4, 5, 6... However, going between "up" and "down" has no effect on 1 and 2... That is, however they were already is how they'll be when going between "up" and "down"...
              • 4. Re: View States
                rtalton Level 4
                Flex states aren't laid out hierarchically. But they are based on other states when created. But you can move from any state to any other state. When you create a new state, Flex asks what existing state you want to base it on just to keep you from creating it from scratch, and that's only a starting point. You are free to remove or add anything to the new state. So there is no issue in moving from your theoretical "up" and "down" states. You don't travel "through" states to arrive at a destination state. If everything is the same, you won't see any changes. If things are different, they'll look different. Flex keeps track of all this for you. I don't see anything which isn't optimal.
                Have you tried doing a mock-up to see the results?
                • 5. View States
                  istrasci Level 1
                  quote:

                  Originally posted by: rtalton
                  Flex states aren't laid out hierarchically. But they are based on other states when created. But you can move from any state to any other state. When you create a new state, Flex asks what existing state you want to base it on just to keep you from creating it from scratch, and that's only a starting point. You are free to remove or add anything to the new state. So there is no issue in moving from your theoretical "up" and "down" states. You don't travel "through" states to arrive at a destination state. If everything is the same, you won't see any changes. If things are different, they'll look different. Flex keeps track of all this for you. I don't see anything which isn't optimal.
                  Have you tried doing a mock-up to see the results?


                  Are you sure states aren't hierarchical...? After reading Amy's comment above, I searched around for info. on Gumbo and found the following documentation from http://opensource.adobe.com/wiki/display/flexsdk/Enhanced+States+Syntax

                  "Goals

                  * Reduce the complexity of the Flex view-states feature by (1) providing a new syntax that allows state-specific object and/or property changes to be specified inline, as opposed to with somewhat more verbose, and out-of-context override tags, and (2) eliminating the concept of hierarchical states. ..."

                  I'll try a simple mockup app. to see what happens...
                  • 6. Re: View States
                    istrasci Level 1
                    After making a few dummy apps., it appears that my reasoning was correct... Within one file/component, having disjoint state graphs only seems to be accomplished by the cumbersome method of having an exponential number of states and carefully managing the transitions yourself...

                    However, if each set of related states is separated into its own file/component, then they do not appear to step on each others' toes... Going back to my previous example, I made a "Login" component with separate "up" and "down" states... Then in the main application file, I had the "open" and "closed" states, and simply added in my "Login" component... Since these state graphs now resided in separate "spaces", they work as needed without regard to anything foreign... So, I got my expected results using this method...

                    Hope this discussion has helped any others encountering such problems... Thanks to everyone who contributed and maybe Adobe will make it easier with Gumbo...
                    • 7. Re: View States
                      Level 7

                      "istrasci" <webforumsuser@macromedia.com> wrote in message
                      news:glkti8$irp$1@forums.macromedia.com...
                      > After making a few dummy apps., it appears that my reasoning was
                      > correct...
                      > Within one file/component, having disjoint state graphs only seems to be
                      > accomplished by the cumbersome method of having an exponential number of
                      > states
                      > and carefully managing the transitions yourself...
                      >
                      > However, if each set of related states is separated into its own
                      > file/component, then they do not appear to step on each others' toes...
                      > Going
                      > back to my previous example, I made a "Login" component with separate "up"
                      > and
                      > "down" states... Then in the main application file, I had the "open" and
                      > "closed" states, and simply added in my "Login" component... Since these
                      > state
                      > graphs now resided in separate "spaces", they work as needed without
                      > regard to
                      > anything foreign... So, I got my expected results using this method...
                      >
                      > Hope this discussion has helped any others encountering such problems...
                      > Thanks to everyone who contributed and maybe Adobe will make it easier
                      > with
                      > Gumbo...

                      Nice summary.

                      Thanks!