Touch.enable无法通过Animate CC在CreateJS中使用

问题描述 投票:0回答:1

我已经在Animate CC中创建了一个html5画布文件,当在触摸屏设备上运行时,似乎无法响应触摸。我创建了一个精简文件来演示该问题。

我在网上发现的所有其他帖子都已通过createjs.Touch.enable(stage)解决,但是,这并不能为我启用触摸功能(并且返回false)。我还包括添加touchstart事件侦听器,但这也无济于事。

我也尝试了this无效。

要在控制台中进行调试,我正在设备仿真模式下使用chrome。在Animate CC中,中心阶段做出响应在发布设置中均被关闭。

以下示例代码的结果:

  • 启用触摸将返回false(所以这可能是问题)
  • 按下鼠标按钮将返回“鼠标向下移动并移动球。”>
  • 按一下没有任何作用
  • 释放触摸会返回“鼠标向下”并移动球。
  • 知道我要去哪里了吗?

Animate CC完全是最新的,createJS是v1.0.0

预期的行为是,就像使用鼠标时一样,触摸开始时会触发touchstart或mousedown处理程序。

console.log("Enable touch: "+createjs.Touch.enable(stage) );  // returns false

ball = this.ball_mc;

// mouse mouse event
ball.on("mousedown", function(event) {
    console.log("mouse down");
    ball.x += 10;
});

// finger down event
ball.addEventListener("touchstart", function mouseDownHandler(e) {
    console.log("finger down");
    ball.x += 10;
});

谢谢! -如果您知道正在发生的事情或解决方法,您将成为救生员!

戴尔。

我已经在Animate CC中创建了一个html5画布文件,当在触摸屏设备上运行时,似乎无法响应触摸。我创建了一个精简文件来演示该问题。每个...

javascript touch createjs easeljs animate-cc
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.