如果我这样做:
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE
投影机将全屏显示,但没有鼠标事件有效,任何想法如何解决这个问题?
修改
这是我的实施:
stage.displayState =StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.mouseLock = true;
只有在Windows中创建项目时才会出现问题,没有鼠标事件可以工作..
EDIT2
stage.addEventListener(FullScreenEvent.FULL_SCREEN_INTERACTIVE_ACCEPTED, fullscreenHandler);
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullscreenHandler);
stage.displayState =StageDisplayState.FULL_SCREEN_INTERACTIVE;
// BUT THIS HANDLER IS NOT CALLED
function fullscreenHandler(event:FullScreenEvent):void {
if(event.type == FullScreenEvent.FULL_SCREEN_INTERACTIVE_ACCEPTED) {
stage.mouseLock = true;
}
}
编辑3:
如果我检查事件FullScreenEvent.FULL_SCREEN
并尝试设置stage.mouseLock = true;
if(event.type == FullScreenEvent.FULL_SCREEN) {
stage.mouseLock = true;
}
我收到此错误:
[Fault] exception, information=Error: Error #3707: Property can not be set in non full screen mode
答案 0 :(得分:0)
当您的应用程序进入全屏模式时,请尝试将舞台的mouseLock
属性设置为true
:
public function fullScreenHandler(event:FullScreenEvent):void {
if(event.type == FullScreenEvent.FULL_SCREEN_INTERACTIVE_ACCEPTED) {
stage.mouseLock = true;
}
}
您添加上述事件处理程序,如:
// will be fired when the user clicks the 'allow' button for fullscreen interactive
stage.addEventListener(FullScreenEvent.FULL_SCREEN_INTERACTIVE_ACCEPTED, fullscreenHandler);
// will be fired when enter/exit fullscreen
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullscreenHandler);
为了能够在全屏模式下工作,您还必须将以下参数添加到嵌入代码中:
<object>
<param name="allowFullScreen" value="true" />
<embed src="example.swf" allowfullscreen="true" />
</object>