こんにちは、Starling/ActionScript 3 で少し設計上の問題があります。
やりたいことはシンプル
dispatchEvent( new flash.events.Event("CloseApp",true)); //send closing bubble events
Main.asに次のメソッドがあります(メインはflash.display.Spriteを拡張します)
public Main():void //constructor
{
addEventListener( "CloseApp" , onCloseApp);
_starling = new Starling(Game, stage); //everythings work ok
_starling.start(); //nice 3d stuff and interactive menu ok.
}
//closing event handling: close the APP
public function onCloseApp( e:flash.events.Event): void
{
NativeApplication.nativeApplication.exit();
}
他のすべてのクラスがイベントを正しくキャッチしている間、イベントを「メイン」に送信する方法がないようです。基本的に、私のアプリケーションで機能しないのは「終了」ボタンだけです。