3 Replies Latest reply on Nov 1, 2011 10:09 AM by Flex harUI

    Too many states, how to handle?

    stevemcl5

      Hi, I'm developing a mobile mp3 player, and have states:   'landscape' and 'portrait'

      also states:  'phone' and 'tablet'

      to create 'landscapePhone' , and 'landscapeTablet', etc

       

      I also have states:

      'buffering'

      'playing'

      'paused'

      'loading'

      'ready'

      etc,

       

      what's the best way of handling this?

      combining the three to get:

      'bufferingLandscapePhone' ,'bufferingLandscapeTablet',  'bufferingPortraitPhone', 'bufferingPortraitTablet',

      etc . . 

      or is there a better way?

        • 1. Re: Too many states, how to handle?
          UbuntuPenguin Level 4

          You may want to look at the ViewStack class.  If the states' stuff isn't superficial, they can become unwieldy VERY quickly.

          • 2. Re: Too many states, how to handle?
            LesBerg

            a (high level) discussion of how to make this conversion would be immensely helpful. I've inherited the maintenance of an app that has six view states and a huge switch statement that handles the display. 

            • 3. Re: Too many states, how to handle?
              Flex harUI Adobe Employee

              What you want is something we call “multi-dimensional states”.  We’ve looked into providing support for it in the SDK, but haven’t had the time and resources to implement it.  One of the tricky aspects of it has to do with handling conflicts. Another is how you would specify transitions.

               

              I don’t know if there is a recommended implementation for “multi-dimensional states” especially one that uses the view states model, but you might find other blog posts about it.  I haven’t had to really deal with it myself, but I would consider using a presentation model and have view elements come and go based on the model’s properties.   It would make it easy to map the model to the BrowserManager as well.