This content has been marked as final. Show 3 replies
It looks like you are dynamically generating the children of the ViewStack, so I don't think States would be the best idea for you. I'm sure you could do it, but I would just remove the current children and then add the new children for the appropriate task.
Can you please elaborate? I've been looking in my various Flex books and can't find anything on dynamically adding and removing children of a viewStack.
Let's say you have your initial 2 ViewStack children:
<Step1 id="step1" />
<Step2 id="step2" tutorial="changeTutorial(event)" />
On Step2 you have a custom event, tutorial. When this event is triggered it will have the information about which steps should be created next.
private function changeTutorial( event:TutorialEvent ) : void
// first remove the two original steps
// now you determine which steps to add and then add them:
var step:Step = new Step();
In other words, use stack.removeChild( component ) and stack.addChild( component );