我使用starling作为图书阅读器应用程序。当我换书时,我处理当前的椋鸟并创建新的椋鸟实例。但是当我创建新的椋鸟时,Gestouch不起作用。
如何为新的starling实例重新启动gestouch
提示代码:
gallery.addEventListener(MouseEvent.CLICK,book);
onKeyDown(event:KeyboardEvent):void
{
if(event.keyCode == Keyboard.BACK )
{
event.preventDefault();
event.stopImmediatePropagation();
this.starling.stop();
this.starling.dispose();
this.starling = null;
}
}
book(e:MouseEvent):void
{
this.starling = new Starling(RacTestApp,stage,viewPort);
Gestouch.inputAdapter ||= new NativeInputAdapter(stage);
Gestouch.addDisplayListAdapter(starling.display.DisplayObject, new StarlingDisplayListAdapter());
Gestouch.addTouchHitTester(new StarlingTouchHitTester(this.starling), -1);
this.starling.start();
}
谢谢