2015-09-07 68 views
0

我有一个名为Startup.as & RacTest.as如何停止Starling并重新启动书籍阅读应用程序?

这里Startup.as是主类,在那里我开始八哥两班。

this.starling = new Starling(RacTest, stage, new Rectangle(xOffset, yOffset, adjustedScreenWidth, adjustedScreenHeight)); 

RacTest.as充当应用程序的引擎并读取我为其指定特定路径的特定书籍。

它完美的作品。现在我需要按回来按钮退出引擎并重新启动RacTest.as来阅读另一本书。

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false, 0, true); 

public function onKeyDown(event:KeyboardEvent):void 
     { 
      if(event.keyCode == Keyboard.BACK) 
      { 
       event.preventDefault(); 
       event.stopImmediatePropagation(); 
RacTest.gameInstance.removeChild(RacTestApp.gameInstance.imageContainer); 
       RacTest.gameInstance.bgSoundChannel.stop(); 
       RacTest.gameInstance.sceneIntSoundChannel.stop(); 
       RacTest.gameInstance.sceneLoadSoundChannel.stop(); 
       Starling.current.stop() 
      } 
     } 

在此先感谢..

回答

0

只需使用这些下列代码完全处置八哥。

this.starling.stop(); 
this.starling.dispose(); 
this.starling = null;