How do I dynamically create Flex 4 AddChild actions for States?
- by TK Kocheran
I have an application in which I need to create mx.states.State objects on the fly, as I'm reading external data in order to create the states. Each State only has a single child, so here's my code which I was using to accomplish this:
var state:State = new State();
state.name = "a";
state.overrides = [new AddChild(parent, DisplayObject(view))];
this.states.push(state);
However, when I actually change a state, I get a runtime error relating to the fact that you can't call addChild on a spark.components.Group component. Is there an equivalent AddElement action for adding elements to a Group during a state change?