View Full Version : Setting Tab Index on button loaded from Library?
joejubee
01-26-2009, 01:02 PM
Hey all,
Is there a way to set the tab index on a button loaded (addChild method) from the library? Granted, you can easily add the tab index to the same button if it's on the stage, but I see no way to add it to the button if it's just chilling in the library...
Thanks,
Joe
Mazoonist
01-26-2009, 01:48 PM
Joe, there's a big difference between the buttons "chilling in the library" and the buttons you might have on the stage. It's the difference between a template for new buttons and instances of that template. The ones in the library are templates. The ones on stage are instances.
Dragging out an instance to the stage at authoring time is the same thing as creating a new one with code and using addChild() to get it to the display. Once it's there, you should be able to set the tabIndex with no problem. So what is the actual problem? Are you getting some kind of error?
joejubee
01-26-2009, 01:58 PM
I'm not getting any sort of error, the button isn't included in the tab order, and I just can't see where you can set the tab index (normally found in the accessibility pane) for an item that is in the library.
It's easy to add that to the object once it's on the stage, but if it gets added at runtime due to user input, I'm not too sure how to handle that.
I'm assuming there is a way to add the tab index through AS3. Here's what I'm using to load the button called "initialPlay" from the library.
var overlayPlay:initialPlay = new initialPlay();
this.addChild(overlayPlay);
overlayPlay.x = 128;
overlayPlay.y = 132;
overlayPlay.alpha = .9;
Thanks for your help!
Joe
joejubee
01-26-2009, 02:05 PM
Duh... I figured it out. I feel stupid.
I just needed to add
overlayPlay.tabIndex = 1;
to the AS.
Thanks!
Mazoonist
01-26-2009, 02:15 PM
Yup! Be sure when you look up a class in the help files, you click the link that says "show inherited public properties." For example, if you look up the SimpleButton class, you won't see a "tabIndex" property listed unless you click the link to show the inherited properties.
joejubee
01-26-2009, 02:23 PM
thanks, man!
Have a great week.
joe
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.