Flex's new States re-parents visual items that are marked with includeIn/excludeFrom. If I have a Group (MainGroup) with 5 children/elements that are state controlled, is there still a way to get a reference to MainGroup's children? mainGroup.numChildren and mainGroup.numElements don't work since the children are re-parented. At best, they show 1.
<s:states>
<s:State name="view1State" />
<s:State name="view2State" />
<s:State name="view3State" />
<s:State name="view4State" />
</s:states>
<s:Group id="mainGroup">
<shipping:OrderShipping id="view1"
includeIn="view1State" />
<payment:OrderPayment id="view2"
includeIn="view2State" />
<verification:OrderVerification id="view3"
includeIn="view3State" />
<confirmation:OrderConfirmation id="view4"
includeIn="view4State" />
</s:Group>
I got the best answer! Well, I will let you decide. Just operate on the states array...
for each (var viewState:State in mainDocument.states)
{
var overrides:Array = viewState.overrides;
for (var i:int = 0; i < overrides.length; i++)
{
var addItems:AddItems = overrides[i];
if (addItems.destination === mainDocument.mainGroup)
trace((addItems.items as UIComponent).name);
}
}