Flash: tabIndex and IE workaround
June 13th, 2006 by LuisProblem:
In Internet Explorer after the last tabIndex, focus goes to the browser address bar.
Solution:
An easy workaround is to create an empty MovieClip which receives keyboard focus and automatically gives focus to the first selectable (editable) text field, button, or movie clip.
Example:
[flash]http://www.blog.lessrain.com/wp-content/upload/test_01.swf,250,100[/flash]
Actionscript:
- import mx.utils.Delegate;
- var timeline:MovieClip = this;
- var myformat:TextFormat = new TextFormat ();
- myformat.font = "Verdana";
- myformat.size = 10;
- var tf1:TextField = timeline.createTextField ("tf1", this.getNextHighestDepth (), 10, 10, 200, 18);
- tf1.type = "input";
- tf1.selectable = true;
- tf1.border = true;
- tf1.setTextFormat (myformat);
- var tf2:TextField = timeline.createTextField ("tf2", this.getNextHighestDepth (), 10, 40, 200, 18);
- tf2.type = "input";
- tf2.selectable = true;
- tf2.border = true;
- tf2.setTextFormat (myformat);
- tf1.tabIndex = 0;
- tf2.tabIndex = 1;
- var tabHackMC:MovieClip = timeline.createEmptyMovieClip ("tabHackMC", timeline.getNextHighestDepth ());
- tabHackMC.tabIndex = 2;
- tabHackMC.onSetFocus = Delegate.create (this, focusLast);
- function focusLast ():Void
- {
- Selection.setFocus ("timeline.tf1");
- }



June 13th, 2006 at 7:23 pm
heh, clever!
September 19th, 2006 at 6:40 am
I wanted to implemnet the same thing in Flash MX 2004. I have encountered this problem and need the solution as uregnetly as it could be.
Thanx,
Vinayak
vinayak.kadam@techbooks.com
October 6th, 2006 at 2:42 pm
Or you could add the SeamlessTabbing property and set it to false.
November 17th, 2008 at 7:36 pm
That’s a smart way to achieve this effect but actually, when using screen readers/tabbing etc, you WANT the user to be able to tab back into the browser. Otherwise, they’re “stuck” in your website with no way to get back into their location bar and visit another site. I talked with my company’s QA department and everyone seems to say that yes, officially a disabled person who could only navigate the web by tabbing has to be able to be able to get back to the location bar as easily as possible.