View Full Version : What's the AS 3.0 for the Selection class?
matbury
11-11-2007, 04:47 PM
Hi,
In AS 2.0, you've got the Selection class with setSelection(), getSelection(), etc.
I think it's been depricated in AS 3.0.
What's the equivalent in AS 3.0? Any links to references or just a class name would be sufficient.
Thanks in advance!
Mazoonist
11-11-2007, 05:44 PM
The TextField class now has a setSelection() method.
matbury
11-11-2007, 08:03 PM
Thanks for the suggestion. I looked it up:
public function setSelection(beginIndex:int, endIndex:int):void
But it's not what I'm looking for. The Selection class was for entire objects, not just the text selected within a TextField.
The Accessibility functions automatically set the focus to the object with the next tab index every time you hit the tab key, and you can see the focus rectangle when its show property is set to true.
I'd like to be able to set the focus to a new object automatically when the user has finished on it. You can do this with AS 2.0, I find it hard to believe you don't have access to this is AS 3.0.
I'm gonna check out the Accessibilty functions.
Any more help would be greatly appreciated.
matbury
11-11-2007, 08:08 PM
You can monitor the focus of objects easily and acurately with the FocusEvent class, but it's a listener - you can't set focus with it.
It must be something to do with the DisplayObject class.
matbury
11-11-2007, 08:11 PM
Couldn't find it in the DisplayObject or DisplayObjectContainer classes.
Sleeve
11-11-2007, 08:20 PM
It's now part of the Stage class. Try this.stage.focus = MyClip; Or even myClip.stage.focus = myClip;
matbury
11-11-2007, 08:21 PM
Ok, I've found something:
The fl.managers.FocusManager class has a setFocus() method:
public function setFocus(component:InteractiveObject):void
And there's a really wacky demo embedded in the Document:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
Check out the example code.
matbury
11-11-2007, 10:38 PM
The eventual answer I've come up with is so complicated, I've sent it to Room 101:
http://www.actionscript.org/forums/showthread.php3?t=152151&page=3
Please have a look at it and tell if there's an easier way!!!
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.