creating the view again and again is not a good solution;
instead you better use data binding and keepdata valid in a singleton
model class...
another (bad) solution is that, if your component do their business job
themselves (connect to server, retrieve data); implement them an "init"
function which you will call when you select that component. the
function will free the data arrays first then retreive data from server...
but as i said before; you better use a singleton Model class.
Berkay Unal wrote On 01/29/2008 12:14 PM:
> Hi Coders
>
> I have 2 buttons and when clicked i am changing the viewstack's
> selectedChild.
>
> My problem is i have some dynamic content on the peopleView. When i
> click on the "UserList" button the stack change and data is loaded.
> But when i click it again it does not refresh. What i need to know is
> every time i click on the a button although the current view is the
> same as the clicked one i want it to be recreated?
>
> Anyone know how to achieve this?
>
> <mx:Button
>
> label="Add Person" click="mainView.selectedChild = personView"
> icon="{__AddPersonIcon}" />
> <mx:Button label="User List" click="mainView.selectedChild =
> peopleView" icon="{__PeopleIcon}" />
>
> <mx:ViewStack
>
> id="mainView" width="100%" height="100%" paddingTop="{myMenuBar.height}" >
> <views:person id="personView" dbConnection="{conn}" />
> <views:people id="peopleView" dbConnection="{conn}" />
> </mx:ViewStack>
>