Gestouch 不工作
Gestouch is not working
我使用 Starling 编写书籍 reader 应用程序。当我换书时,我正在处理当前的八哥并创建新的八哥 instance.But 当我创建新的八哥时,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();
}
谢谢
大家好,我得到答案了:
OnKeydown(){
Gestouch.removeTouchHitTester(this.myStarlingTouchHitTester);
}
book(){
this.myStarlingTouchHitTester = new StarlingTouchHitTester(this.starling);
Gestouch.addTouchHitTester(this.myStarlingTouchHitTester, -1);
}
如果我们使用多个 Starling 实例,我们必须添加和删除 TouchHitTester
。
我使用 Starling 编写书籍 reader 应用程序。当我换书时,我正在处理当前的八哥并创建新的八哥 instance.But 当我创建新的八哥时,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();
}
谢谢
大家好,我得到答案了:
OnKeydown(){
Gestouch.removeTouchHitTester(this.myStarlingTouchHitTester);
}
book(){
this.myStarlingTouchHitTester = new StarlingTouchHitTester(this.starling);
Gestouch.addTouchHitTester(this.myStarlingTouchHitTester, -1);
}
如果我们使用多个 Starling 实例,我们必须添加和删除 TouchHitTester
。