我想在 Flex mobile 的 Image 组件中检测 touchBegin 事件,但是当我设置 <...touchBegin="myMethod()" /> 时,当我触摸该图像时它不会触发。
有任何想法吗?
我想在 Flex mobile 的 Image 组件中检测 touchBegin 事件,但是当我设置 <...touchBegin="myMethod()" /> 时,当我触摸该图像时它不会触发。
有任何想法吗?
您可能看不到任何触发事件的原因是,根据设备的不同,touchBegin 可能不是在触摸开始时触发的事件,哪些设备使用 touchBegin 和哪些设备使用 mouseDown 似乎存在一些差异。
例如,为了测试这一点,我使用了将以下属性放入图像中:
touchBegin = "touchBeginHandler(event)"
mouseDown = "mouseDownHandler(event)"
以及以下代码:
protected function touchBeginHandler(event:TouchEvent):void
{
trace("Touched");
}
protected function mouseDownHandler(event:MouseEvent):void
{
trace("Moused");
}
在手机模拟器和我的实际手机上,结果都是“鼠标”的跟踪语句。长话短说,尝试使用鼠标按下事件来查看是否获得了想要的结果。
I think you have to actually enable the multi touch gestures mode on mobile to get the touch events instead of mouse events.