Thanks for that suggestion.

I was able to cancel the TabNavigator change by doing the following:

In my main app (where the TabNavigator is contained) in the 
creationComplete event, I add a listener:

myTabNavigator.addEventListener
(MouseEvent.CLICK,handleTabNavigatorClick,true);


Then within that click event I call:

event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();




--- In [email protected], Scott Melby <[EMAIL PROTECTED]> wrote:
>
> When I did this (for validation purposes) I had to extend the 
> TabNavigator and override the selectedIndex setter method.  I then 
> provided an inteface (ITabChild) that my views could implement.  
When 
> the setter is called, you can then check if the child is an 
ITabChild 
> and if so call the methods you define in that interface before 
actually 
> setting the selected tab.
> 
> hth
> Scott
> 
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com
> http://blog.fastlanesw.com
> 
> 
> 
> guitarguy555 wrote:
> > Thanks for the reply,
> >
> > That doesn't work though.  If I set up an IndexChangedEvent event 
> > listener, calling event.preventDefault() doesn't stop the tab 
from 
> > changing.
> >
> >
> >
> > --- In [email protected], "Luciano Manerich Junior" 
> > <luciano.manerich@> wrote:
> >   
> >> Hi,
> >>  
> >> you can add an eventListener on the TabNavigator, listening for 
an 
> >>     
> > IndexChangedEvent and do all your validations...
> >   
> >>  
> >> And if you need to cancel the current change, you could try an 
> >>     
> > evt.preventDefault();
> >   
> >>  
> >> private function changeIndex(evt:IndexChangedEvent):void
> >> {
> >>     evt.preventDefault(); // cancel the changing
> >> }
> >>  
> >>
> >> ________________________________
> >>
> >> De: [email protected] 
[mailto:[EMAIL PROTECTED] 
> >>     
> > Em nome de guitarguy555
> >   
> >> Enviada em: terça-feira, 1 de abril de 2008 16:16
> >> Para: [email protected]
> >> Assunto: [flexcoders] TabContainer with modules - how to cancel 
Tab 
> >>     
> > change
> >   
> >>
> >> I have a Flex Application that has a TabNavigator. Each tab 
> >>     
> > contains a 
> >   
> >> moduleLoader that loads a corresponding Module. 
> >>
> >> On some of these modules, I have a basic Form with Validators 
> >>     
> > connected 
> >   
> >> to it. I want to be able to make sure that the form values are 
> >>     
> > valid 
> >   
> >> before the user navigates away from the currently selected tab 
by 
> >> clicking a new tab. 
> >>
> >> In other words, I want the Validator to fire when the user 
clicks 
> >>     
> > on a 
> >   
> >> new tab and if there are any invalid values I want to prompt the 
> >>     
> > user 
> >   
> >> to fix them and stop the event propogation so the TabNavigator 
> >>     
> > stays on 
> >   
> >> the current tab.
> >>
> >> How can I cancel the TabNavigator change?
> >>
> >>     
> >
> >
> >
> >
>


Reply via email to