图像touchBegin flex mobile

时间:2012-03-15 16:07:01

标签: flex flex4 flex-mobile

我想检测Flex mobile中Image组件中的touchBegin事件,但是当我设置< ... touchBegin =“myMethod()”/> ,但是当我触摸该图像时它不会触发。

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

您可能没有看到任何触发事件的原因是,取决于设备,touchBegin可能不是触摸开始时触发的事件,似乎有些差异在哪些设备使用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");
} 

在手机模拟器和我的实际手机上,结果都是“Moused”的跟踪声明。长话短说,尝试使用鼠标按下事件来查看是否得到了您想要的结果。

答案 1 :(得分:1)