6 Replies Latest reply on Aug 4, 2011 10:27 PM by Slacer

    backkey not working after state change

    Slacer

      Hello,

       

      I have a simple view containing a list in state "Channels" and a barchart in state "Charts".

      This view has a custom backkeyhandler assigned which simply changes the state back to "Channels" if the hardware backkey was pressed while in "Charts" mode.

       

      The app launches and shows two items in its list.

      If I touch one of its entry, I load the data for this item and change the view to "Charts" which displays the bar chart.

      Pressing the back key does nothing in the emulator and brings me back to the homescreen on my nexus s.

      But - if I touch the bar chart once before pressing the back key, it brings me back to the "Charts" state.

       

      Using the debugger with a breakpoint in the following function confirmed, that this function will not be called after a state change if I don't touch the bar chart.

       

      While it is possible to use two views for the list and charts presentation, I need the backkey to work within different states because I want to use states to

      use different layouts for phones vs. tablets.

       

      Any ideas?

      Michael

       

      protected

       

       

      function view1_backKeyPressedHandler(event:FlexEvent):void

      {

      // TODO Auto-generated method stub

      if ( currentState == "Charts" ) {

      event.preventDefault();

      setCurrentState(

      "Channels");

      }

      }