0

In a mobile Flex game I have a View listing a weekly top of players.

It works well enough :-) On the top I have a search field. Also when you click a player name in the list, another View is pushed - displaying more info for that user:

enter image description here

I have 2 annoyances: when I pop the player details View and return back to the View shown in the above screenshot -

  1. The search field is empty
  2. The List ist scrolled all the way up again

Any advice please on how to save/restore those 2 values best?

UPDATE: I save those values as static variables for now...

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416

1 Answers1

1

I also used static variables for this, another way would be the create a value object for your view. What I mostly do is:

  • Suppose my view is called ScoreListView, I create a VO called ScoreListViewData and it contains a viewData property (of type Object) and then I create properties for other things related to the view and not it's data. You can add cachedListPosition and currentSearchString to it and before deactivating the view (in the viewDeactivate event) you can save those values so you have them in your data object of the view when it is activated again.

Works for me ;-)

Fréderic Cox
  • 321
  • 2
  • 7
  • 22