【发布时间】:2013-10-07 02:05:21
【问题描述】:
我需要以下代码的帮助,我想添加移动触摸点击事件。我已经通过代码 sn-ps 面板添加了代码。
如果我在已发布的电影中单击,代码会执行,但一旦我通过 AIR Mobile 调试启动器中的触摸设置对其进行测试,它就会给我以下错误
“TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::TouchEvent@5fe2ec1 to 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++;
}
}
【问题讨论】:
标签: flash mobile touch-event