我有一个 flex 应用程序,它在某个点加载 stage3D (starling) 游戏。到目前为止一切正常,我可以隐藏应用程序并仅显示游戏层,但是当游戏完成时问题就来了,我想返回 flex 应用程序并从舞台上删除游戏。
我确实试图停止游戏并从 stage3d 中删除所有孩子,但这不起作用,下次我尝试重新显示它没有显示的游戏。
这是我正在使用的一些代码
添加游戏并启动它(一切正常)
starlingGame = new Starling(Game, this.systemManager.stage);
starlingGame.antiAliasing = 0;
starlingGame.start();
starlingGame.showStats = true;
// this event is dispatched when stage3D is set up
starlingGame.stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
这是我尝试删除/卸载游戏的方法-由于某些原因,这第一次有效,但之后上面的代码不会使游戏第二次显示:(
starlingGame.stop();
starlingGame.removeEventListener(Event.CONTEXT3D_CREATE, onContextCreated);
starlingGame.stage.removeChildren();
starlingGame = null;