2013-01-20 70 views
1

我一直在試圖找出了好幾天!如何獲得平滑滾動觸摸設備上的所有其他應用程序有..暫且我實現了這一點:AS3:光滑的觸摸滑動滾動的iOS

Multitouch.inputMode = MultitouchInputMode.GESTURE; 

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler); 

function fl_SwipeHandler(event:TransformGestureEvent):void 
{ 
    switch(event.offsetX) 
    { 
     // swiped right 
     case 1: 
     { 
      // Start your custom code 
      // This example code moves the selected object 20 pixels to the right. 

      // End your custom code 
      break; 
     } 
     // swiped left 
     case -1: 
     { 
      // Start your custom code 
      // This example code moves the selected object 20 pixels to the left. 

      // End your custom code 
      break; 
     } 
    } 

    switch(event.offsetY) 
    { 
     // swiped down 
     case 1: 
     { 
      // Start your custom code 
      // This example code moves the selected object 20 pixels down. 
      if (PActive == true) { 
       dgPlace.verticalScrollPosition = dgPlace.verticalScrollPosition - 60; 
      } 
      if (SActive == true) { 
       dgSubject.verticalScrollPosition = dgSubject.verticalScrollPosition - 60; 
      } 
      if (OActive == true) { 
       dgObject.verticalScrollPosition = dgObject.verticalScrollPosition - 60; 
      } 
      if (FActive == true) { 
       dgFeeling.verticalScrollPosition = dgFeeling.verticalScrollPosition - 60; 
      } 
      if (AActive == true) { 
       dgAction.verticalScrollPosition = dgAction.verticalScrollPosition - 60; 
      } 
      if (NActive == true) { 
       dg.verticalScrollPosition = dg.verticalScrollPosition - 60; 
      } 
      // End your custom code 
      break; 
     } 
     // swiped up 
     case -1: 
     { 
      // Start your custom code 
      // This example code moves the selected object 20 pixels up. 
      if (PActive == true) { 
       dgPlace.verticalScrollPosition = dgPlace.verticalScrollPosition + 60; 
      } 
      if (SActive == true) { 
       dgSubject.verticalScrollPosition = dgSubject.verticalScrollPosition + 60; 
      } 
      if (OActive == true) { 
       dgObject.verticalScrollPosition = dgObject.verticalScrollPosition + 60; 
      } 
      if (FActive == true) { 
       dgFeeling.verticalScrollPosition = dgFeeling.verticalScrollPosition + 60; 
      } 
      if (AActive == true) { 
       dgAction.verticalScrollPosition = dgAction.verticalScrollPosition + 60; 
      } 
      if (NActive == true) { 
       dg.verticalScrollPosition = dg.verticalScrollPosition + 60; 
      } 
      // End your custom code 
      break; 
     } 
    } 

這基本上只是說如果發生滑動,然後向上或向下滾動60個單位,這是2行的活動數據網格。請任何人有任何想法如何做到這一點,我將不勝感激的幫助。^_^

+0

我不知道我理解你的問題。首先,刷卡不滾動!爲什麼你想爲數據網格實現自己的滾動實現?網格帶有它自己的滾動容器。如果你想爲你的網格使用某種類型的滑動(無論出於何種原因),我強烈推薦使用Gestouch庫。 – AlBirdie

+0

刷卡滾動本身不上航的iOS應用程序在DataGrid中的建議工作..謝謝,我會試試看。 – 4t0m1c

回答

0

只是一個建議(雖然我還沒試過此我自己),輕掃經驗真的取決於影片剪輯(或內容)的大小。

所以,也許而是採用了固定的60號,你可以使用像dgSubject.height/3。 (3,這樣你可以通過3次滑動結束)。

只是想扔東西引發更多的思考。

另外,我剛找到以下鏈接: http://www.greensock.com/throwprops/ http://www.swfgeek.net/2011/09/08/greensocks-throwpropsplugin-ipad-test/

看看他們解決您的問題