Check if SWF has focus

How to check if the SWF element on the page has focus?

In IE, events are onkeydownnot detected in JavaScript if SWF has focus, but Firefox always detects onkeydown.

+3
source share
2 answers

Detect it with Javascript? Javascript has events onFocusand onBlur,

var hasFocus=false;

DomElem.addEventListener('focus', function(e){
    hasFocus=true;
},false);

DomElem.addEventListener('blur', function(e){
    hasFocus=false;
},false);

I am not sure how to do this in AS ...

+1
source

I think that when the focus is fired, the flash fires Event.ACTIVATE . You can also listen to MOUSE_OUT on stage to see when the flash loses focus.

+2
source

Source: https://habr.com/ru/post/1791014/


All Articles