I'd recommend that on the show event you do all of your initializing you
need for the view.  Then on the hide, you clear out all of the data from the
view.

Dale

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cameron
Childress
Sent: Wednesday, July 30, 2008 10:04 AM
To: [email protected]
Subject: Re: [AFFUG Discuss] Best event to listen for when ViewStack child
becomes active?

This is actually just a stack of screens for a Cairngorm app.  When a screen
becomes active, I'd like to reset the form on that screen and set the focus
to the first form field.  Pretty common problem, I just couldn't find the
right event.

I was trying creationComplete(), added(), add(), and addedToStage()...
 I was plodding through the docs trying to find the right event.

Looks like show() is the right one!  I love learning a new language, but I
hate getting stuck on silly stuff like this.

Thanks!

-Cameron

On Wed, Jul 30, 2008 at 9:50 AM, Scott Talsma <[EMAIL PROTECTED]>
wrote:
> Is there some reason that you cannot use the change on the viewStack 
> itself?  There are also show/hide events on the underlying containers.  
> I perhaps mistakenly assume you have tied this to a tabNav or similar 
> navigation container.
>
> On Wed, Jul 30, 2008 at 8:56 AM, Cameron Childress 
> <[EMAIL PROTECTED]>
> wrote:
>>
>> What's the best event to listen for when a *specific* child of a 
>> ViewStack becomes active?  I'd like to set some defaults on a 
>> specific child each time it becomes active (not just the first time, 
>> and not just when it is created) and can't seem to find the right
combination.
>>  I'm using a fairly common pattern to change the viewstack...
>>
>> private function getView(i:int): Container {
>>       if (i == VIEW_MAIN) {
>>               // can't fire event here, main doesn't exist yet!
>>               return main;
>>       } else {
>>               return login;
>>       }
>> }
>>
>> <mx:ViewStack selectedChild="{ getView( viewState ) }" >
>>       <view:Login     id="login" mysteryEventToListenFor="???"/>
>>       <view:Main      id="main" />
>> </mx/ViewStack>
>>
>> Advice would be appreciated...
>>
>> Thanks!
>>
>> -Cameron
>>
>> --
>> Cameron Childress
>> Sumo Consulting Inc
>> http://www.sumoc.com
>> ---
>> cell: 678.637.5072
>> aim: cameroncf
>> email: [EMAIL PROTECTED]
>>
>>
>> -------------------------------------------------------------
>> To unsubscribe from this list, simply email the list with unsubscribe 
>> in the subject line
>>
>> For more info, see http://www.affug.com Archive @ 
>> http://www.mail-archive.com/discussion%40affug.com/
>> List hosted by http://www.fusionlink.com
>> -------------------------------------------------------------
>>
>>
>
>
>
> --
> Scott Talsma
> CTO, echoEleven
>
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe 
> in the subject line
>
> For more info, see http://www.affug.com Archive @ 
> http://www.mail-archive.com/discussion%40affug.com/
> List hosted by FusionLink
> -------------------------------------------------------------



--
Cameron Childress
Sumo Consulting Inc
http://www.sumoc.com
---
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]


-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------





-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to