I have a viewstack that animates its children by sliding them in and out. It
works fine when the creationPolicy is set to all, but when it's set to auto,
uncreated views slide in blank, then render themselves.
I thought that I could fix this by checking to see if a view has been created
yet (the only way I could figure out how to do this is
mx_internal::numChildrenCreated), and then trigger its creation with
createComponentFromDescriptor. For some reason this isn't working though- my
creationComplete function is never called...what am I doing wrong?
override public function set selectedIndex(value:int):void
{
_lastIndex = selectedIndex;
if(value != _lastIndex && value >= 0 && _lastIndex >= 0)
{
_newIndex = value;
var targetChild:Container = getChildAt(value) as Container;
if (targetChild.mx_internal::numChildrenCreated < 0)
{
targetChild.addEventListener(FlexEvent.CREATION_COMPLETE,child_creation,false,0,true);
createComponentFromDescriptor(targetChild.descriptor,true);
targetChild.validateNow();
return;
}
else
{
slideTabs(_lastIndex,_newIndex);
}
}
}
private function child_creation(event:Event):void
{
slideTabs(_lastIndex,_newIndex);
}