Copy link to clipboard
Copied
Copy link to clipboard
Copied
There is still no solution to this?
Copy link to clipboard
Copied
Is there still no fix for this? As a dirty hack, would it work to force the focus to some html element, in other words "unfocus" from the Flash object? How to do that?
It seems that Firefox and Chrome have the same problem, however Internet Explorer is ok (ctrl+w, ctrt+n, ctrl+t etc. works even when Flash object has the focus).
Copy link to clipboard
Copied
I fixed it. Now I can use ctrl+w, ctrl+n, ctrl+t, ctrl+l etc. on my page even there is only Flash visible and nothing else. The method puts the focus out of Flash each time the Flash is clicked. So it's not any more possible to navigate the Flash by keyboard. That's the downside of this solution (or added bonus, actually the keyboard navigation can be also only annoying in many cases). There was also a solution forwarding only specific keypresses but I didn't try that (http://stackoverflow.com/questions/254111/flash-steals-browser-focus).
This is my solution, tested on IE, Firefox and Chrome:
add 'wmode','opaque' to the Flash AC_FL_RunContent part in the html
add <param name="wmode" value="opaque" /> to the Flash object part in the html
this goes anywhere in the html:
<script type="text/javascript" language="javascript">
function changeFocus(){
var elem = document.getElementById("anyIdThatExistsInHtml");
elem.tabIndex = 0;
elem.focus();
elem.blur();
}
</script>
and the AS3 script needs this bit (or customize to your purposes):
import flash.external.ExternalInterface;
..
function onMouseClick(ev:Event):void
{
ExternalInterface.call("changeFocus");
}
stage.addEventListener(MouseEvent.CLICK, onMouseClick);
Copy link to clipboard
Copied
The mentioned solution doesn't work on (static) text fields. I was trying to find a way to detect mouse click even when mouse is over a static text field. Looks like there is no way except by putting an invisible masking object on top. That will break for example the possibility to click links on the text. Is there really no way to detect mouse click over a static text field?
Copy link to clipboard
Copied
I fixed the text field problem, or made a workaround. This new solution is needed if there are text fields where you could click but you don't want to loose ctrl+w, ctrl+n etc. capability. The main downsides to this workaround are:
- Firefox: you have to copy your text quickly after selection if you want to do that (selection vanishes soon)
- Firefox: if you have a web link on your static text and you click it, you can't hold mouse button for 700ms+
- all other browsers: Right click + Copy does work but ctrl+c you have to press quickly, otherwise it doesn't copy
- on Safari, the keyboard capability breaks if you click multiple times on a text box (probably not so difficult to fix)
This is the new javascript (same as before except some new lines, rememeber the wmode=opaque thing!):
<script type="text/javascript" language="javascript">
function changeFocusAgain(){
var elem = document.getElementById("anyIdThatExistsInHtml");
elem.tabIndex = 0;
elem.focus();
elem.blur();
}
function changeFocus(){
var elem = document.getElementById("anyIdThatExistsInHtml");
elem.tabIndex = 0;
elem.focus();
elem.blur();
setTimeout("changeFocusAgain()",700);
}
</script>
..and the AS3:
import flash.external.ExternalInterface;
..
function onMouseClick(ev:Event):void
{
ExternalInterface.call("changeFocus");
}
stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, onMouseClick);
stage.addEventListener(MouseEvent.CLICK, onMouseClick);
Copy link to clipboard
Copied
It'd probably be the one best improvement for Flash to have this type of functionality, just with an better and easier implementation. Now I realize how bad it has been all this time, watching videos played in Flash objects, they never allow for example ctrl+w (close). I got used to it as something that simply can't be overcome. Of course it can and it should've been fixed many years ago.
(Controlling both Flash object and browser on keyboard simultaneously should not be very difficult to implement either, should it?)
Copy link to clipboard
Copied
I agree. Adobe should attempt to create a public API that allows the toggling of native keyboard shortcuts on major browser. The API should atleast consider common shotcuts (close tab, new tab, go back, go forward) This is one of the TOP reasons many users dislike Flash. The functionality seems like it should be easy to implement. I'm building an application and I am going to use AS3 and JS to accomplish this. Even though my app is still in it's embryotic stages, I plan on making a public API for such functions. It would be cool though if the native AS3 API could handle this though... Adobe, heed my (our) call!