I can imagine what the problem is, but I can't seem to reproduce in a simple context.
Here is a 'dirty hack'...as2 style , based on the MOUSE_LEAVE thing.
input.onKillFocus = function(newFocus:Object) {
trace(this._name+" lost focus. New focus changed to: "+newFocus._name);
delete input._parent.onEnterFrame;
};
input.onSetFocus = function(oldFocus:Object) {
trace(this._name+" gained focus. Old focus changed from: "+oldFocus._name);
input._parent.onEnterFrame = trackMouse;
}
function trackMouse():Void{
if(input._xmouse < 0 || input._xmouse > (input._x + input._width)) onMouseOut();
if(input._ymouse < 0 || input._ymouse > (input._y + input._height)) onMouseOut();
}
function onMouseOut():Void{
Selection.setFocus(dummyBtn);
}
Assuming input is a selectable textfield. If the textfield is focused I add an enterFrame listener to check if the mouse is over or outside the textield ( using input._xmouse, opposed to _xmouse which is global ). If the mouse is outside the text area, I change the focus to a dummy object( a Button called dummyBtn ). This works if you're in Firefox and you have a selection and release outside the swf, because as soon as you leave the textfield the focus shifts to the dummyBtn.
I admit it is a bit rough, if you still need the selection or something, so let me know.
Goodluck.
George Profenza
2009-04-30 11:44:11