OsaSoft
OsaSoft

Reputation: 599

AS3 No keyboard response (except for Space button) and can't type into input TextFields while in HTML

I have no problem with my app when I run it ctrl+enter or when I only open the .swf file, but once I open the HTML file and go into fullscreen mode, for some reason, I can't type into the text fields that are input any more. What's weirdest is that while the Space key still works, the Shift key doesn't.

Here's some code parts:

stage.scaleMode=StageScaleMode.SHOW_ALL;
stage.addEventListener(MouseEvent.CLICK,fullScreen);
stage.addEventListener(KeyboardEvent.KEY_UP,keys);
...
function keys(e:KeyboardEvent):void{
switch(e.keyCode){
    case Keyboard.SHIFT:
        popup.popupText.text=popupResult();
        popup.visible=!popup.visible;
    break;
    case Keyboard.SPACE:
        switch(stav){
            case 0:
                stav=1;
                var date:Date=new Date();
                startTime=date.getTime();
                zarovkaA.play();
                horakB.play();
                timer.start();
            break;
            case 2:
                stav=3;

                counter.visible=false;
                leftIn.visible=false;
                rightIn.visible=false;
                inBg.visible=false;

                leftOut.visible=true;
                rightOut.visible=true;
                centropol.visible=true;

                leftOut.text=getResult(leftIn.text);
                rightOut.text=getResult(rightIn.text);

                centropol.text="s CENTROPOL ENERGY\njsi na svícení ušetřil\n";
                            /*+(calToKc(parseInt(leftIn.text))+
                              calToKc(parseInt(rightIn.text)))
                            +" Kč/rok";*/
                calSum+=parseInt(leftIn.text)+parseInt(rightIn.text);
            break;
            case 3:
                stav=0;
                counter.visible=true;
                counter.text=format(maxTime);

                inBg.visible=false;

                leftIn.visible=false;
                rightIn.visible=false;
                leftOut.visible=false;
                rightOut.visible=false;

                rightIn.text="";
                leftIn.text="";

                centropol.visible=false;
            break;
        }
    break;
}
}
...
function fullScreen(e:MouseEvent):void{
stage.displayState=StageDisplayState.FULL_SCREEN;
}

Upvotes: 0

Views: 550

Answers (1)

Discipol
Discipol

Reputation: 3157

you need to use instead of StageDisplayState.FULLSCREEN, StageDisplayState.FULLSCREEN_INTERACTIVE which will give you a popup to allow or not typing in the swf, which is something the user allows or not.

Note this works only with Flash Player 11.1 or above. Or was it 11.3? Anyway always compile in last or next to last flash player (for security, performance and stability).

Upvotes: 1

Related Questions