我有一个使用Apache Flex 4.9.1构建的web应用程序,我正在尝试将主应用程序的子组件全屏显示。我已经尝试了以下代码,我的视图大小不会改变。
private function onFullScreen(event:MouseEvent):void
{
this.removeElement(view);
this.stage.getChildAt(0).visible = false;
this.stage.addChild(view);
view.width = stage.fullScreenWidth;
view.height = stage.fullScreenHeight;
this.stage.displayState = StageDisplayState.FULL_SCREEN;
this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenChange);
}
private function onFullScreenChange(event:FullScreenEvent):void
{
this.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenChange);
if ( !event.fullScreen )
{
this.stage.getChildAt(0).visible = true;
this.stage.removeChild(view);
this.addElement(view);
view.percentHeight = view.percentWidth = 100;
}
}
我试过在视图上调用invalidate但似乎没什么用。
答案 0 :(得分:1)
你有allowed full screen mode in HTML吗?
<param name="allowFullScreen" value="true" />