0

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

主.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 );
    }
    }

下一个视图.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 );
}
}
4

1 回答 1

0

更正确的方法是将这个逻辑(滑动手势处理)从视图移到主类。您需要添加到现有处理中的只是获取新的视图类。

于 2012-03-28T11:17:23.793 回答