我有一个容器有多个滚动图像,我添加了TouchEvent.TOUCH
作为事件监听器而不是MouseEvent.CLICK
,因为starling不支持MouseEvent
。 问题是当我在图像之间导航时,它会听取TouchEvent
,而我不需要这个?有没有解决方案而不是TouchEvenet
?将MouseEvent.CLICK添加到starling图像
代码:
private function onComplete (event:flash.events.Event):void
{
bitmapData = Bitmap(LoaderInfo(event.target).content).bitmapData;
var newImage:Image = Image.fromBitmap(Bitmap(LoaderInfo(event.target).content));
newImage.height = 154;
newImage.width = 180;
addChild(newImage);
newImage.addEventListener(starling.events.TouchEvent.TOUCH,image_clickHandler);
}
private function image_clickHandler(event:starling.events.TouchEvent):void
{
var touch:Touch = event.getTouch(stage);
if (touch != null)
{
if (touch.phase == TouchPhase.BEGAN)
{
//some code
}
}
}
'TouchEvent'不是代替MouseEvent'的'!同样的'TouchEvent'也像普通的'MouseEvent'一样在浏览器中工作。 – Cherniv 2013-05-07 09:16:56
我搜索并找到了[问题](http://forum.starling-framework.org/topic/mouse-events),因为我写的TouchEvent不是MouseEvent – 2013-05-07 09:22:35
好吧,它是“同一个班级”。你用“舞台”来试试这个解决方案吗? – Cherniv 2013-05-07 09:25:23