"Work-arounding"
private function changeIndex(evt:IndexChangedEvent):void
{
if( !validUserInteraction() )
{
evt.target.selectedIndex = evt.oldIndex;
}
}
________________________________
De: [email protected] [mailto:[EMAIL PROTECTED] Em nome de guitarguy555
Enviada em: terça-feira, 1 de abril de 2008 17:07
Para: [email protected]
Assunto: Re: RES: [flexcoders] TabContainer with modules - how to cancel Tab
change
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] <mailto:flexcoders%40yahoogroups.com> ,
"Luciano Manerich Junior"
<[EMAIL PROTECTED]> 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:flexcoders%40yahoogroups.com>
> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ]
Em nome de guitarguy555
> Enviada em: terça-feira, 1 de abril de 2008 16:16
> Para: [email protected] <mailto:flexcoders%40yahoogroups.com>
> 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?
>