Feb 25
Adobe Air e Fullscreen
AIR, AS3, Flash, Flex | oscar | Commenta l'articolo |
Un modo per fare un vero full screen in Adobe AIR senza barra di stato:
public function Main():void { NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke); ... } private function onInvoke(event:InvokeEvent):void { toggleFullScreen(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; ... } private function toggleFullScreen():void { stage.displayState = ( stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE ) ? StageDisplayState.NORMAL : StageDisplayState.FULL_SCREEN_INTERACTIVE; }
Per consentire all’applicazione di andare correttamente in FullScreen, bisogna attendere che questa si sia inizializzata completamente. Adobe Air, a tale scopo, mette a disposizione un evento chiamato “InvokeEvent.INVOKE”. Tale evento indica, appunto, il completamento di tutte le operazioni interne di inizializzazione. Non ci resta quindi che catturarlo e attraverso lo Handler richiamare la funzione che attivi il FullScreen!
L’autore è Ocho Durando
In alternativa è possibile settare stage.displayState in AS3:
// Enter Fullscreen Interactive State stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE; // Enter Standard Fullscreen State stage.displayState = StageDisplayState.FULL_SCREEN; // Enter Normal State stage.displayState = StageDisplayState.NORMAL;
La logica è identica a Javascript:
// Enter Fullscreen Interactive State window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE; // Enter Standard Fullscreen State window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN; // Enter Normal State window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.NORMAL;
Ultimi Commenti