Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 AS3:退出全屏事件侦听器_Actionscript 3_Flash_Events - Fatal编程技术网

Actionscript 3 AS3:退出全屏事件侦听器

Actionscript 3 AS3:退出全屏事件侦听器,actionscript-3,flash,events,Actionscript 3,Flash,Events,如何添加通过按escape键监听退出全屏事件的事件侦听器 stage.addEventListener(Event.RESIZE, backtoresize) //doesn't work :( 谢谢:)试试: stage.nativeWindow.addEventListener(Event.RESIZE, backtoresize); 尝试: 我就这样过的 mcVideoControls.btnFullscreen.addEventListener(MouseEvent.CLICK,

如何添加通过按escape键监听退出全屏事件的事件侦听器

stage.addEventListener(Event.RESIZE, backtoresize)  //doesn't work :(
谢谢:)

试试:

stage.nativeWindow.addEventListener(Event.RESIZE, backtoresize);
尝试:

我就这样过的

mcVideoControls.btnFullscreen.addEventListener(MouseEvent.CLICK, fullscreenClicked);



function fullscreenClicked(e:MouseEvent):void {
                //fullscreen works only with an internet browser
                if (stage.displayState == StageDisplayState.NORMAL) {
                    stage.displayState = StageDisplayState.FULL_SCREEN;
                } 
                else {
                    stage.displayState = StageDisplayState.NORMAL;
                }
            }
但你可以重写它。然后会是这样的。。。。等等,等等

package {
    import flash.display.Stage;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;

    public class UserInputHandler{  
        //escape button var
        public static var keyEscape:Boolean;

        public function UserInputHandler(stage:Stage){
            //this events are sending the value true when specific keyboard button is pressed to the stage.
            stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
            stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
        }
        //you can provide more key codes in the function
        private function keyDownHandler(e:KeyboardEvent):void{  
            switch(e.keyCode){
                case Keyboard.ESCAPE:
                    UserInputHandler.keyEscape = true;
                    break;

            }
        }
        //function when key is released from pressing
        private function keyUpHandler(e:KeyboardEvent):void{
            switch(e.keyCode){
                case Keyboard.ESCAPE:
                    keyEscape = false;
                    break;
            }
        }
    }
}
我就这样过的

mcVideoControls.btnFullscreen.addEventListener(MouseEvent.CLICK, fullscreenClicked);



function fullscreenClicked(e:MouseEvent):void {
                //fullscreen works only with an internet browser
                if (stage.displayState == StageDisplayState.NORMAL) {
                    stage.displayState = StageDisplayState.FULL_SCREEN;
                } 
                else {
                    stage.displayState = StageDisplayState.NORMAL;
                }
            }
但你可以重写它。然后会是这样的。。。。等等,等等

package {
    import flash.display.Stage;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;

    public class UserInputHandler{  
        //escape button var
        public static var keyEscape:Boolean;

        public function UserInputHandler(stage:Stage){
            //this events are sending the value true when specific keyboard button is pressed to the stage.
            stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
            stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
        }
        //you can provide more key codes in the function
        private function keyDownHandler(e:KeyboardEvent):void{  
            switch(e.keyCode){
                case Keyboard.ESCAPE:
                    UserInputHandler.keyEscape = true;
                    break;

            }
        }
        //function when key is released from pressing
        private function keyUpHandler(e:KeyboardEvent):void{
            switch(e.keyCode){
                case Keyboard.ESCAPE:
                    keyEscape = false;
                    break;
            }
        }
    }
}
stage.addEventListener(全屏事件、全屏等) 这将触发您是否进入或离开全屏。

stage.addEventListener(全屏事件.全屏等)
这会触发您是否全屏进入或离开。

这在移动平台之间可能有所不同。请澄清目标是什么。AdobeAIR 3.8 for Desktop这可能在移动平台之间有所不同。请澄清目标是什么。Adobe AIR 3.8 for Desktop尝试了它并给出了错误:1046:Type未找到或不是编译时常量:event。尝试了它并给出了错误:1046:Type未找到或不是编译时常量:event。如果我需要切换键或函数,这将非常有效,但事实上,我只在非全屏状态下使用全屏按钮。我也试过“退出”按钮,效果很好!但只要人们按退出键离开全屏模式,这是可以的。。如果他们通过其他方法做了呢?“离开全屏”功能不会触发,也不会显示返回全屏按钮!非常感谢您的时间:)如果我需要一个切换键或功能,那就太好了,但事实上我只在非全屏状态下使用全屏按钮。我也试过“退出”按钮,效果很好!但只要人们按退出键离开全屏模式,这是可以的。。如果他们通过其他方法做了呢?“离开全屏”功能不会触发,也不会显示返回全屏按钮!非常感谢你抽出时间:)你在开玩笑!:我一直都知道这个事件,但从没想过它是双向的!谢谢!它就像一个符咒你在开玩笑!:我一直都知道这个事件,但从没想过它是双向的!谢谢!它就像一个符咒