How do I dynamically create Flex 4 AddChild actions for States?
Posted
by
TK Kocheran
on Stack Overflow
See other posts from Stack Overflow
or by TK Kocheran
Published on 2010-12-27T21:48:11Z
Indexed on
2010/12/27
21:54 UTC
Read the original article
Hit count: 188
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?
© Stack Overflow or respective owner