简体   繁体   English

在Flex Mobile应用程序中区分滚动和滑动

[英]Differentiate between scroll and swipe in Flex Mobile Application

Is it possible to differentiate between a Horizontal Swipe gesture and a Horizontal Scroll in Flex Mobile. 是否可以在Flex Mobile中区分“水平滑动”手势和“水平滚动”。 I have a List (horizontal layout) with no listener attached to it, and a view, with a GestureSwipe listener attached to it, when I try to scroll the list the swipe gesture gets fired, obviously. 我有一个列表(水平布局),没有附加任何侦听器,还有一个视图,上面装有GestureSwipe侦听器,当我尝试滚动列表时,显然会触发滑动手势。 I have tried to add a gesture event listener to the list and call a function with event.stopPropagation() which does stop the gesture being fired in the view, but as the list takes up 85% of the screen real-estate this makes it quite difficult to make the view event fire, which defeats the object of what I want to do. 我试图将一个手势事件侦听器添加到列表中,并使用event.stopPropagation()调用一个函数,该函数不会停止在视图中触发手势,但是由于列表占用了85%的屏幕空间,因此使视图事件触发非常困难,这使我想要执行的操作失败了。

Is there a way to tell the 2 actions apart, speed, duration or something else? 有没有办法区分速度,持续时间或其他两个动作?

Using FlashDevelop, and Flex SDK v4.14.1, Air 17.0, building for Android 使用FlashDevelop和Flex SDK v4.14.1,Air 17.0(针对Android构建)

Thanks 谢谢

Ok, so I can't find out how to differentiate between the 2 events, however there seems to be a workaround, not a good one, but I suppose it could work, however I see an issue with adding the event listener after the list has scrolled to it's furthest point, you would require another scroll/swipe action to make the view transition, not a good experience for the users. 好的,所以我无法找出如何区分这两个事件,但是似乎有一种解决方法,不是一个好的方法,但是我想它可以工作,但是我发现在列表后面添加事件监听器存在问题滚动到最远点,您将需要执行另一次滚动/滑动操作以使视图过渡,这对用户来说不是一个很好的体验。

list.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE,propertyChangeHandler );

protected function propertyChangeHandler(event:PropertyChangeEvent):void
{
    if (event.property == "horizontalScrollPosition" )
    {
        if (event.newValue == (event.currentTarget.measuredWidth - event.currentTarget.width )) {
                navigator.pushView(view.RightView);
        }
        if(event.newValue == 0){
                navigator.pushView(view.LeftView);
        }
    }
}

Does anyone have any thoughts on this approach? 有人对这种方法有什么想法吗?

我从未开发过Flex Mobile,但是如果您可以重写interceptOnTouchEvent来获取事件,则可以区分“水平滑动”手势和“水平滚动”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM