Hmm, yes tab indexing and the FocusManager have always been buggy to say the least!
I've tried a few things myself, not sure if this is of much help though!
In pure AS3, because we're deriving from sprite, the focusManager instance at stage level seems to be unavailable.
It's obviously there somewhere, as any tabEnabled items in your code are controlled by it. But I too have been unable to find a way to directly access it.
So I'm not sure what to suggest to stop the items outside of the form from tabbing when the form is visible.
If you use mxml for your flash/flex apps; mxml uses mx:Application as a base class for the app and the stage-wide FocusManager instance, called focusManager is available and you can manipulate it.
I've tried creating an AS3 class which derived from/extended Application, but without any luck so far. I keep getting various errors.
I guess one workaround could be to manipulate the tabEnabled properties of the items you want to exclude from the global tab-loop. So you set the tabEnabled property to false for anything you don't want tabbable when the form is visible.
So perhaps, as soon as your form is made visible, you call a function to toggle the tabEnabled property for all items you want disabled and then when the form is finished with, you call the function again to re-enable them.
i.e.
private function toggleTabEnabled():void
{
// These are the items you want to toggle tabEnabled for.
btn1.tabEnabled = !btn1.tabEnabled; // use the NOT operator
btn2.tabEnabled = !btn2.tabEnabled; // '!' to toggle the
// tabEnabled property
}
But as you're dealing with nested clips things aren't quite so cut and dry as that. You'd probably have to set up some kind of event dispatcher/listener system so that when index.swf displays the form, it will call its own toggle function to disable the tab enabled items you don't want accessible. It would also have to dispatch an event to it's parent (main.swf) to inform its parent that it needs to call it's toggle function.
Likewise, when the form is finished with, index.swf would have to call it's toggle function and then dispatch an event to it's parent (main.swf) to get it to call it's toggle function.
If you get my meaning?
Not an elegant solution, but it's an option I guess.
However, thinking about it. From an accessibility point of view, should you really be disabling any of your tab enabled UI components at any point? If somebody doesn't have a mouse connected, shouldn't they still be able to access some of the other UI components outside the form via tab when the form is visible?
If there are any UI components which have to be disabled at any point (e.g. they are disabled until the user has filled in the form, or until they've clicked on a particular button) then where you disable/enable those items by setting the enabled property, you can also set the tabEnabled property too. Which will stop them getting tab-focus when they're disabled. That way only the enabled items will be included in the stage-wide tab loop.
Generally with the tab-loop, the items are added to the tab index in the order in which they were added to the stage, but manually specifying their place in the tab-order by setting the tabIndex propertyshould allow you to set the order. But as I've already said, the focus manager in flash seems to be quite buggy and that's with just the one seemingly inaccessible instance at stage level...As for dealing with multiple instances of the focus manager, who knows?!
But I'll keep playing and try to keep you posted!
Cheers for now,
Jas.