Can you please post a simple, complete, compilable sample application that demonstrates this so we can investigate further?
Here is a simple demo.
- Press button to switch to next view
- Select Item 1 or Item 2 to change the state of this view to chart
- Press hardware back key or the requiered shortkey in the emulator to switch back from chart to list mode in the same view
- Press the back key again to jump to the logon view of this app.
Currently the back key does work if you touch the display once before pressing the back key. Otherwise you find yourself on the phone homescreen.
could you please confirm my findings?
I need to know if there is a work-around for this problem.
I'm seeing this in 4.5.0 and 4.5.1, but it appears to be fixed in the latest internal development build of Flex. I'll see if I can find a workaround.
The problem is that the focus of the stage is pointing to the list after it has been removed from the display list. Here is what's happening:
1) Press the "Item 1" item
2) stage.focus is automatically set to that item
3) Change state to charts
4) List is removed from the display list
5) Press back
6) No back event is fired because the list has focus but isn't on the display list
To workaround this issue, set stage.focus to null right after you change the state. So your list change handler would look like this:
protected function list1_changeHandler(event:IndexChangeEvent):void
stage.focus = null;
In my internal tests with 4.5.1, this fixes your issues.
Let me know if that doesn't work out.
your solution works in the emulator as well as on my actual device.
This means that if a state change in a given view removes the object with the current focus, the back key stopps working.
Your fix solves this problem.
Thank you for your solution.