I'm having a problem with AS3 and keyboard focus, and I'm wondering if there is a variable or a function I can use that will output to screen the name of the object that currently has keyboard focus?
+2
A:
You do it through the FocusManager. Then you can simply call the getFocus function. I put together a quick example that shows the current focus every second, really meaningless as it is, but it shows you how it works:
import fl.managers.FocusManager;
var focus:FocusManager = new FocusManager(this);
function traceFocus():void
{
trace(focus.getFocus())
}
setInterval(traceFocus,1000);
Just put this code in the root and then some input boxes on the stage and it should work. Also, check out the documentation
Charlie boy
2009-04-27 08:12:13