I still believe that all children of a viewstack are created no matter the 
creationpolicy.  CreationPolicy affects the grandchildren.  CreationComplete on 
the child is long gone.  Try listening to SHOW as well, and call validateNow on 
the entire viewstack, not just the child.  Children get their size from the 
parent.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of dfalling
Sent: Friday, September 18, 2009 12:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Still struggling with creation complete



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);
}

Reply via email to