Here's a sample app with the sliding viewstack.  The problems in this example 
are a) I'm failing to make the new view create itself, b) I don't know what to 
listen to in the event that I succeed with a).

Thanks.

http://flexninja.com/examples/slidingViewstack/

--- In [email protected], Alex Harui <aha...@...> wrote:
>
> The code for a SHOW event runs before things are drawn to the screen.  Sound 
> like something is causing an extra invalidation of the children so they 
> aren't ready right away.  Can you make a simple test case?
> 
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.<http://www.adobe.com/>
> Blog: http://blogs.adobe.com/aharui
> 
> From: [email protected] [mailto:[email protected]] On 
> Behalf Of dfalling
> Sent: Friday, September 18, 2009 2:28 PM
> To: [email protected]
> Subject: [flexcoders] Re: Still struggling with creation complete
> 
> 
> 
> I'm not sure how SHOW would help me as I want to make everything happen 
> before rendering the child.
> 
> As an experiment, I made the child createComponentsFromDescriptors and called 
> validateNow() at the viewstack level. I also replaced the event listener with 
> a timer since I have no idea what event to watch.
> 
> All my attempts to make the child render itself aren't working- even if the 
> timer waits for several seconds to allow an empty view to render, it still 
> won't show up until after sliding in. Even once I get this working, I still 
> won't know what event to listen for to know when the child's children are 
> created. There's the lovely childrenCreationComplete event, but that's only 
> dispatched for creation types of none and queued.
> 
> Here's my current code:
> 
> override public function set selectedIndex(value:int):void
> {
> _lastIndex = selectedIndex;
> 
> if(value != _newIndex && value != _lastIndex && value >= 0 && _lastIndex >= 0)
> {
> _newIndex = value;
> var targetChild:Container = getChildAt(value) as Container;
> if (targetChild.mx_internal::numChildrenCreated < 0)
> {
> targetChild.createComponentsFromDescriptors(true);
> validateNow();
> _creationTimer = new Timer(3000,1);
> _creationTimer.addEventListener(TimerEvent.TIMER,child_creation,false,0,true);
> _creationTimer.start();
> return;
> }
> else
> {
> slideTabs(_lastIndex,_newIndex);
> }
> }
> }
> 
> private function child_creation(event:Event):void
> {
> slideTabs(_lastIndex,_newIndex);
> }
> 
> --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Alex 
> Harui <aharui@> wrote:
> >
> > 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: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On 
> > Behalf Of dfalling
> > Sent: Friday, September 18, 2009 12:09 PM
> > To: [email protected]<mailto:flexcoders%40yahoogroups.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