FULL_SCREEN_INTERACTIVE模式:"允许"按一下按钮被传递给应用程序应用程序、按钮、模式、FULL_SCREEN_INTERACTIVE

2023-09-08 11:07:41 作者:贱男村村长

在一个AS3游戏(使用Flex 4.10.0)我想,让玩家聊天,甚至当他们的在全屏模式下。

In an AS3 game (using Flex 4.10.0) I would like to allow players to chat, even when they are in fullscreen mode.

所以,我现在用的是下面的ActionScript code(即 _fullBox 复选框触发全屏模式在我的Web应用程序):

So I am using the following ActionScript code (the _fullBox checkbox triggers fullscreen mode in my web application):

public function init():void {
    if (stage.allowsFullScreenInteractive)
        stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreen, false, 0, true);
}

private function toggleFullScreen(event:MouseEvent):void {
    stage.displayState = 
        stage.displayState == StageDisplayState.NORMAL ?
        StageDisplayState.FULL_SCREEN_INTERACTIVE :
        StageDisplayState.NORMAL;
}

private function handleFullScreen(event:FullScreenEvent):void {
    _fullBox.selected = event.fullScreen;
}

<s:CheckBox id="_fullBox" click="toggleFullScreen(event)" label="Full Screen" />

这工作在这个意义上,全屏模式,成功进入,用户可以使用键盘进行聊天了。

This works in the sense that the fullscreen mode is entered successfully and users can use the keyboard to chat too.

不幸的是,点击对话框中的允许按钮(显示允许全屏幕与键盘控制?)被传递到Web应用程序。

Unfortunately, the click at the "Allow" button in the dialog (displaying "Allow full screen with keyboard controls?") is being passed down to the web application.

和我的情况下,它resuls在大堂的点击在打表,你可以在截图中看到,因此(不必要的)加入游戏:

And in my case it resuls in the click at a playing table in the lobby as you can see in the screenshot and thus (unwanted) joining a game:

这(错误?)已经看到了Windows 7 /的64位和Flash Player 11,8,800,115。

This (bug?) has been seen with Windows 7 / 64 bit and Flash Player 11,8,800,115.

任何人能请您分享一个不错的解决方法吗?

Can anybody please share a good workaround for this?

我想加入一个透明的雪碧 UIComponent 我上面的Web应用程序,但问题是,当(即哪些方法)来显示/隐藏呢?

I was thinking of adding a transparent Sprite or UIComponent above my web application, but the question is when (i.e. in which methods) to display/hide it?

更新:

调用 event.stopPropagation() handleFullScreen()并没有什么帮助。

Calling event.stopPropagation() from handleFullScreen() doesn't help anything.

更新2:

我Adobe公司提交错误#3623333 。

I've submitted Bug #3623333 at Adobe.

更新3:在心里告诉自己 - stage.allowsFullScreenInteractive 是没用的,因为只有设置在媒体链接在全屏模式下

UPDATE 3: A note to myself - stage.allowsFullScreenInteractive is useless, because only set when allready in fullscreen mode.

推荐答案

正如你所说,你需要创建一个透明层,以避免不需要的点击事件。您可以隐藏该层时,屏幕恢复到正常状态或用户接受的全屏状态下( FULL_SCREEN_INTERACTIVE_ACCEPTED 事件将解雇)。

As you mentioned, you need to create transparent layer to avoid undesired click events. you can hide this layer when screen returned to normal state or user accepted fullscreen state (FULL_SCREEN_INTERACTIVE_ACCEPTED event will fired).

演示(版本的Adobe Flash 11.3必填)

Demo (flashplayer 11.3 required)

var transparentLayer:Sprite=new Sprite();
var timer:Timer = new Timer(50, 1);
init();
function init():void {
    transparentLayer.graphics.beginFill(0,0.1);
    transparentLayer.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
    transparentLayer.graphics.endFill();
    transparentLayer.visible=false;
    addChild(transparentLayer);
    timer.addEventListener(TimerEvent.TIMER_COMPLETE,handleTimerComplete);
    stage.addEventListener(FullScreenEvent.FULL_SCREEN_INTERACTIVE_ACCEPTED,handleFSIA);
    _fullBox.addEventListener(MouseEvent.CLICK,toggleFullScreen);
    stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreen);
}
function toggleFullScreen(e:MouseEvent):void {
    if(stage.displayState == StageDisplayState.NORMAL){
        stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;

        transparentLayer.visible=ExternalInterface.available;

    }else
        stage.displayState=StageDisplayState.NORMAL;
}
function handleFullScreen(e:FullScreenEvent):void {
    _fullBox.selected = e.fullScreen;
    if(stage.displayState == StageDisplayState.NORMAL)
        transparentLayer.visible=false;
}
function handleFSIA(e:FullScreenEvent):void{
    timer.reset();
    timer.start();
}
function handleTimerComplete(e:TimerEvent):void{
    transparentLayer.visible=false;
}