I have an app with 2 states: "estado1" and "estado2"
In state "estado1" I have this:
<s:BorderContainer id="BoxAbajo" includeIn="estado1">
... a lot of things here ...
when I change to "estado2" state, what happen with my "BoxAbajo" and all its content??? It becomes like not visible?
The component is still loaded in memory and has CPU load?
The components in other state that is not active are consuming CPU or memory?
you know where I can read about this?
By default state-specific content is not created until needed (e.g. until the first time you enter the state), but from that point on it persists off the display list until needed again (for example when you leave a state). There is a cost to creating and destroying instances unnecessarily so this is why the default is the way it is (especially for components that are needed often).
You can use 'destructionPolicy' attribute and set to 'auto' if you wish components to be cleaned up when leaving a state. Keep in mind you will have to ensure you have nothing pinning the instance in memory, but in this case the states infrastructure will do everything it can to releases its references.
thanks Corey, but, where I put the "destructionPolicy" attribute?
I have try in <s:Application destructionPolicy='auto' ..> and in <s:states destructionPolicy='auto' ...> and doesn´t work in any of them...