There is no function on the child pane that is called when the ViewStack switches to it. All the ViewStack does is bring that child to the front. But if you write a handler for the ViewStack's "change" event, it will get called every time selectedIndex or selectedChild changes. So you can do something like this:

 

<mx:Script>

    private function changeHandler(event:Event):void

    {

        if (viewStack.selectedChild == pane1)

            pane1.name = "Gordon";

    }               

</mx:Script>

 

<mx:ViewStack id="vs" chage="changeHandler(event)">

    <mx:Canvas id="pane0">

        ...

    </mx:Canvas>

    <mx:Canvas id="pane1">

        <mx:TextInput id="name"/>

    </mx:Canvas>

   

</mx:ViewStack>

 

If each pane were a component with a reinitialzie() method that you wrote, you could simplify this so

 

    <mx:ViewStack id="vs" change="vs.selectedChild.reinitialize()">

        ...

     <mx:ViewStack>

 

But using databinding is even easier.

 

- Gordon

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of jlentz2112
Sent: Saturday, October 14, 2006 2:59 PM
To: [email protected]
Subject: [flexcoders] Re: How to invalidate ViewStack Pages

 

How do you reinitialize a pane? Is there some function that is called
everytime you switch to a new child? I'm wanting to pass an object
into a child each time I call it, so I need someway to have a function
called automatically when a child is switched to, so I can
reinitialize and use the data just passed in.

Thanks,

jelentz
--- In [EMAIL PROTECTED]ups.com, "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> Databinding is one way to accomplish this:
>
>
>
> <mx:TextInput id="name" text="{someDataObject.name}"/>
>
>
>
> Another would be to write a "change" handler on the ViewStack. Switch on
> the selectedIndex and re-initialize the pane you're changing to.
>
>
>
> - Gordon
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of jlentz2112
> Sent: Friday, October 13, 2006 8:17 PM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] How to invalidate ViewStack Pages
>
>
>
> Hi,
>
> I've got a ViewStack that I navigate around using selectedIndex. It
> works fine the first time I go to a page, but when I leave and return
> to that same page, I need to have all the TextInput fields
> re-initialized. It doesn't seem to do that. Returning to a
> previously selected index displays the data that was there when I left
> that page - not the new data I have. Is there a way to force a child
> page to create or refresh its different fields?
>
> Thanks,
>
> jelentz
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to