See the Change event for the tabnavigator.
 

 
<http://groups.yahoo.com/group/flexcoders/message/74877;_ylc=X3oDMTJzcW1
1NGIwBF9TAzk3MzU5NzE1BGdycElkAzEyMjg2MTY3BGdycHNwSWQDMTcwNTAwNzIwNwRtc2d
JZAM3NDg3NwRzZWMDZG1zZwRzbGsDdm1zZwRzdGltZQMxMTc5NzI1NTQ5> Navigating
away from a Tab 


Posted by: "Flexing..."  <mailto:[EMAIL PROTECTED]
Re%3ANavigating%20away%20from%20a%20Tab> [EMAIL PROTECTED]
<http://profiles.yahoo.com/bhuvangupta> bhuvangupta 


Sun May 20, 2007 9:35 pm (PST) 

Hi All,

I have a tab navigator each containing a form where user needs to 
fill some information.

Now what I want to do is that if a user tries to move away from a Tab 
without completing or saving the information,
I want to show an Alert (Changes will be lost if you navigate away 
from the page. Continue .. yes/no) and
want to move to other tab only after use clicks Yes on this alert.

How can I implement this in Flex ?

One solution I thought of is:
1. Add a listener for the "change" event.
2. Store a flag for the tab. Switch it on when an edit is made on the 
form (how do I track edits!!)
3. On Tab change see if flag is on, show alert. If use clicks yes, 
just hide the alert
else
set the selected Index of the tab back to the old index.

Now the above solution will work if the Tab Navigator is the only 
navigator but if it is a child tab navigator then I will have to 
track the tab change on the parent tab navigator as well...
This will further complicate if there is Tree navigation , multiple 
ViewStacks etc etc ...

if anyone has any suggestions on how to implement this better, it 
will be great.

Thanks



This email and any attached files are confidential and intended solely for the 
intended recipient(s). If you are not the named recipient you should not read, 
distribute, copy or alter this email. Any views or opinions expressed in this 
email are those of the author and do not represent those of the  company. 
Warning: Although precautions have been taken to make sure no viruses are 
present in this email, the company cannot accept responsibility for any loss or 
damage that arise from the use of this email or attachments.

Reply via email to