简体   繁体   中英

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. 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. 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.

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

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来获取事件,则可以区分“水平滑动”手势和“水平滚动”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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