2 Replies Latest reply on Nov 22, 2012 10:21 PM by heartgoon

    How to prevent scrolling at the top and bottom of the list

    heartgoon Level 1

      when scrolled to the top or bottom of the list,it could continue scrolling through it would be back to the top or bottom after you release your finger.

      if i want to prevent continuing scrolling when the list is at the top and bottom,how could i do?

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:com="com.*"
              xmlns:model="model.*"
              creationComplete="onInit()" backgroundColor="0xff0000">
          <fx:Declarations>
              <!-- 将非可视元素(例如服务、值对象)放在此处 -->
          </fx:Declarations>
          
          <fx:Script>
              <![CDATA[
                  import model.ItemData;
                  
                  import mx.collections.ArrayCollection;
                  [Bindable]
                  private var dp:ArrayCollection = new ArrayCollection();
                  protected function onInit():void{
                      for (var i:int = 0; i < 100; i++) {                    
                          var item:ItemData = new ItemData(i, 'A' + i.toString());                    
                          dp.addItem(item);                    
                      }
                      
                      dp.refresh();                
                      list.ensureIndexIsVisible(70);
                  }
              ]]>
          </fx:Script>
          <s:VGroup x="10" width="100%" >
              <s:Label x="10" text="ListDemo:" width="100%"/>
              <s:List id="list" x="10" height="200"            
                      itemRenderer="views.MyItemRenderer"            
                      dataProvider="{dp}">
                  
              </s:List>
          </s:VGroup>
      </s:View>
      

      example.jpg