Starling中Touch TypeError: Error #1009

来源:互联网 发布:can数据传递系统是根据 编辑:程序博客网 时间:2024/06/06 03:12
touch = event.getTouch(stage);
touchX = touch.globalX;

touchY = touch.globalY;

TypeError: Error #1009: 无法访问空对象引用的属性或方法。


解决: 

touch = event.getTouch(stage);

if(touch){


touchX = touch.globalX;

touchY = touch.globalY;

}




原创粉丝点击