Search code examples
actionscript-3

How do I force or lock focus in actionscript 3?


I want to create a dialog or alert box, where a DisplayObject would take and force the focus, until an okay button or something releases the lock. thanks.


Solution

  • The easy way to do this is to make your "dialog" as big as the stage, with a whacking great transparent area around the dialog itself.

    The transparent area can listen for any mouse clicks, and just swallow them (which will prevent them being picked up by stuff further back in the display list).

    To show the alert, just stick it on top of everything else, When the user closes it, take it away again.