Created
July 12, 2011 15:15
-
-
Save amacdougall/1078176 to your computer and use it in GitHub Desktop.
Mouse return focus detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.alanmacdougall.underscore._; | |
// and then, after View is added to stage... | |
stage.addEventListener(Event.MOUSE_LEAVE, function handleMouseLeave(event:Event):void { | |
stage.removeEventListener(Event.MOUSE_LEAVE, handleMouseLeave); | |
stage.addEventListener(MouseEvent.MOUSE_OVER, function handleMouseReturn(event:MouseEvent):void { | |
stage.removeEventListener(MouseEvent.MOUSE_LEAVE, handleMouseReturn); | |
// wait 500ms to let other handlers sort themselves out, I guess | |
_(function():void { | |
trace("Mouse has returned; current keyboard-focused DisplayObject is " + stage.focus); | |
}).delay(500); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment