This content has been marked as final. Show 6 replies
I usually use the show event, and then I write a handler function to "reset" the view. Nothing will reset the components for you, so you need to do it in your handler.
You can also delete the class and recreate it.
However, you need to be careful as to not create a memory leak.
Thanks for replying,
So are you saying the 'show' event handler is what resets the view, or do you mean that the 'show' event handler is the one that initializes the new view, and a separate handler (say, for the 'hide' event) is he one that resets or destroys the current view.
I'm just not sure if it's one of those cases where I can't destroy the view on the hide because it fires when everything is already gone off the stage.
I think I have a pretty good grasp on what I'm going to do, but I'm curious as to what your opinion would be. Thanks again for your help.
Are you suggesting using the AS3 equivalent ? instantiate, addChild(), removeChild() ? I've considered that as well. Thanks again for replying.
The show event should be dispatched each time the view is "shown", but you have to write the reset logic.
removeChild won't work, as it will still have the same property values next time you add it. I think you can say:
myView = null;
Here is an example ViewStack "tab selection" method: