Hallo, i need a little help. I have created my won component named myComponent1. I added this component to the state1 of my application. Now, my component works fine but i wish to rebuild it at all when i change to state2 and come back to state1 of my application. How can i destroy my component and rebuild it again resetting all variables to their initial values??
Thx for help
Cant' you just reset it? It is way cheaper taht destroy and create again. There
is an leaving state event fired by flex (see docs for the exact name) adn you
can reste the component on leaving the state.
Ok, but what is the command for resetting my component?
Depending on what the component needs to reset you implement your logic.
private function reset():void
this.var1 = ""; //reset a string
//perform other logic here including visual resets (use component lifecycle
methods to make it performant);
event.newState = "state2"
//reset state 1