我需要以下代码的帮助,我想添加移动触摸点击事件。我已经通过代码片段面板添加了代码。
如果我单击已发布的电影,代码会执行,但是一旦我通过 AIR Mobile 调试启动器中的触摸设置对其进行测试,它就会给我带来以下错误
“TypeError:错误 #1034:类型强制失败:无法将 flash.events::TouchEvent@5fe2ec1 转换为 flash.events.MouseEvent。”......
// create all the cards, position them, and assign a randomcard face to each
for(var xx:uint=0;xx<boardWidth;xx++) { // horizontal
for(var yy:uint=0;yy<boardHeight;yy++) { // vertical
var c:card = new card(); // copy the movie clip card
c.stop(); // stop on first frame
c.x = xx*cardHorizontalSpacing+boardOffsetX; // set position
c.y = yy*cardVerticalSpacing+boardOffsetY;
var r:uint = Math.floor(Math.random()*cardList.length); // get a random face
c.cardface = cardList[r]; // assign face to card
cardList.splice(r,1); // remove face from list
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
c.addEventListener(TouchEvent.TOUCH_TAP, clickCard);
c.addEventListener(MouseEvent.CLICK,clickCard); // have it listen for clicks
trace(c.name);
addChild(c); // show the card
cardsLeft++;
}
}