mardi 29 décembre 2015

Toggling Full Screen view on Key press in Flash via Actionscript3

Below is my code aimed at getting my flash content to toggle between full screen view and normal view on press of the spacebar key, so far no compiler errors yet does not work.

import flash.events.KeyboardEvent;

stage.addEventListener (KeyboardEvent.KEY_DOWN, toggleScreenview);
function toggleScreenview(e:KeyboardEvent):void {
    if (e.keyCode == Keyboard.SPACE){
        stage.displayState = StageDisplayState.FULL_SCREEN;
    } else {
    stage.displayState = StageDisplayState.NORMAL;
    }
}

Aucun commentaire:

Enregistrer un commentaire