Reputation: 1648
///toggle
var tamEkranMi:Boolean = false;
toggle.buttonMode = true;
toggle.addEventListener(MouseEvent.CLICK, tamEkran);
function tamEkran(e:MouseEvent)
{
if(tamEkranMi == false)
{
tamEkranMi = true;
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
toggle.gotoAndStop(2);
}
else
{
tamEkranMi = false;
toggle.gotoAndStop(1);
stage.displayState = StageDisplayState.NORMAL;
}
}
/*top of this works fine
below this just doesn't work when i try on a website
*/
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
function reportKeyDown(e:KeyboardEvent):void
{
switch(e.keyCode)
{
case Keyboard.ESCAPE:
tamEkranMi = false;
toggle.gotoAndStop(1);
} /*
if(e.keyCode == Keyboard.ESCAPE)
{
tamEkranMi = false;
stage.displayState = StageDisplayState.NORMAL;
toggle.gotoAndStop(1);
}*/
}
Here is my code block. When i use this in my computer it just works fine but when i use a website to try these codes just not working. The toggle button works but when i use ESC key on my keyboard that code block simply doesn't work.
Upvotes: 0
Views: 204
Reputation: 9839
I think that your problem is just because you are using the Escape key which is reserved to exit the fullscreen mode of the flash player standalone version or in the web browser when the fullscreen mode is active, otherwise, you can catch it without any problem.
For the FULL_SCREEN_INTERACTIVE
mode, don't forget to enable it in your html code.
Hope that can help.
Upvotes: 2