Hi,
I have developed my application to contain multiple states. Each of
the states displays custom components. before moving from one state to
another, I need to remove the components in the previous, state.
The problem is how do i use removechild call for different targets in
the same state.
pseudo code:
<mx:state name="state1">
<mx:removechild id="rmchild1" target="{uicomp1}"/>
<mx:addchild target="{customcomp1}"/>
</mx:state>
<mx:state name="state2">
<mx:removechild id="rmchild2" target="{uicomp2}"/>
<mx:addchild target="{customcomp2}"/>
</mx:state>
<mx:state name="state3">
<mx:removechild id="rmchild3" target="{uicomp3}"/>
<mx:addchild target="{customcomp3}"/>
</mx:state>
This works great when I switch from state1->state2->state3. but when i
want to switch from state2 to state1, my removechild, target should be
my customcomp2 and not uicomp1. How do i bring about this.
I tried to define a function for onEnter for state1, but without any
]effect. can somebody please let me know how do I set the removechild
target dynamically. i tried to accomplish it with the below code, but
it does not work. could somebody please guide me here.
private function onEnterState(statename:String):void
{
switch (prevstate)// this is the stte that the application was
// before changing the state
{
case state2:
this.rmchild1.target = customcomp2;
case state1:
this.rmchild1.target = uicomp1;
}
}
Could somebody point me in the right direction on how to do this? i
searched the docs but was not sucessfull with this.