Android Flex + AIR应用程序的滑动手势

时间:2012-03-28 08:49:01

标签: android flex air swipe-gesture

有没有办法扩展此代码以滑动到此代码中的3个以上的视图?

Main.MXML

 private function handleSwipe(event:TransformGestureEvent):void
    {
    var slideViewTransition:SlideViewTransition = new SlideViewTransition();    
    // Swipe was to the right
    if (event.offsetX == 1 ) {
    slideViewTransition.direction = ViewTransitionDirection.RIGHT;
    navigator.pushView( PreviousView, null, null, slideViewTransition );
    }
    // Swipe was to the left
    else if (event.offsetX == -1 ) {
    slideViewTransition.direction = ViewTransitionDirection.LEFT;
    navigator.pushView( NextView, null, null, slideViewTransition );
    }
    }

NextView.MXML

import spark.transitions.SlideViewTransition;
import spark.transitions.ViewTransitionDirection;   
private function handleSwipe(event:TransformGestureEvent):void
{
var slideViewTransition:SlideViewTransition = new SlideViewTransition();
if (event.offsetX == 1 ) {
slideViewTransition.direction = ViewTransitionDirection.LEFT;
navigator.pushView( ThreeView, null, null, slideViewTransition );
}
}

1 个答案:

答案 0 :(得分:0)

更正确的方法是将这个逻辑(滑动手势处理)从视图中移出到主类。你需要添加到现有处理中的所有内容都是获得新的视图类。