ActionScript shiftKey Not Working In Full Screen Mode?
Posted
by Chunk1978
on Stack Overflow
See other posts from Stack Overflow
or by Chunk1978
Published on 2010-03-20T21:43:47Z
Indexed on
2010/03/20
21:51 UTC
Read the original article
Hit count: 216
i've drawn an ellipse sprite and added it to the display list of a container, which is added to the display list of the stage. to move the sprites with the keyboard arrows, it appears that my shiftModifier:Number variable is not working when the stage's display state is set to full screen. shiftModifier works as it should when the stage's display state is set to Normal.
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
function onKeyboardDown(evt:KeyboardEvent):void
{
var shiftModifier:Number = 0.25;
if (evt.shiftKey) {shiftModifier = 10;}
if (evt.keyCode == Keyboard.UP) {ellipse1.y -= shiftModifier;}
if (evt.keyCode == Keyboard.DOWN) {ellipse1.y += shiftModifier;}
if (evt.keyCode == Keyboard.LEFT) {ellipse1.x -= shiftModifier;}
if (evt.keyCode == Keyboard.RIGHT) {ellipse1.x += shiftModifier;}
}
fsm.addEventListener(MouseEvent.CLICK, toggleFullScreenMode);
function toggleFullScreenMode(evt:MouseEvent):void
{
if (stage.displayState == StageDisplayState.FULL_SCREEN)
{stage.displayState = StageDisplayState.NORMAL;}
else
{stage.displayState = StageDisplayState.FULL_SCREEN;}
}
full screen is tested in Safari and Firefox.
© Stack Overflow or respective owner