觸摸

2017-06-23 130 views
6

的ActionScript 3和Flex 4滾動的TileList我被困在一個問題與Adobe Flex 4和ActionScript 3觸摸

我有Flex中TileList中,像這樣:

<mx:TileList id="myList" change="test(event)" paddingLeft="28" width="1080" wordWrap="true" height="1420" rowHeight="475" columnWidth="350" dataProvider="{floorPlans}" itemRenderer="FloorplanItems" selectionColor="#ffffff" rollOverColor="#ffffff"> 

</mx:TileList> 

而且我試圖使其滾動觸摸,因爲這會在觸摸屏上,我有嘗試兩種不同的方式,使這個滾動觸摸,一個包裹它的火花滾動,像這樣:

<s:Scroller> 

    <s:Group> 

     <mx:TileList id="myList" change="test(event)" paddingLeft="28" width="1080" wordWrap="true" height="1420" rowHeight="475" columnWidth="350" dataProvider="{floorPlans}" itemRenderer="FloorplanItems" selectionColor="#ffffff" rollOverColor="#ffffff"> 

     </mx:TileList> 

    </s:Group> 

</s:Scroller> 

但是,當我去在我的觸摸屏上測試,沒有任何反應。

另一種方法是增加一個TransformGestureEvent.GESTURE_SWIPE事件偵聽器,像這樣:

<mx:Script> 
    <![CDATA[ 

      import flash.ui.Multitouch; 
      import flash.ui.MultitouchInputMode; 

      Multitouch.inputMode = MultitouchInputMode.GESTURE; 

      import flash.events.Event; 

      public function init(): void 
      { 
       trace("here"); 
       myList.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe); 
      } 

      public function onSwipe (e:TransformGestureEvent):void{ 

       if (e.offsetY == 1) { 
        //User swiped towards bottom 
        myList.y += 100; 
       } 
       if (e.offsetY == -1) { 
        //User swiped towards top 
        myList.y -= 100; 
       } 

      } 
    ]]> 
</mx:Script> 

但同樣,這並沒有什麼....我運行的想法......我怎麼做我的TileList可觸摸滾動?

+0

你可以加入這個在線模擬器並提供一個鏈接? –

+0

在線模擬器? – user979331

+0

像jsfiddle,phpfiddle,sqlfiddle這樣的工作片段 –

回答

0

您應該使用interactionMode屬性:

<mx:TileList interactionMode="touch"/> 

可能的值是 「觸摸」 或 「鼠標」。 由於Spark組件更新且專門爲移動性能而設計,因此建議使用<s:List/>而不是<mx:TileList />