0 Replies Latest reply on May 1, 2013 6:44 AM by jasonzhuang

    how to change IViewPort verticalScrollPosition programmatically

    jasonzhuang Level 1

      I'm trying to scroll VGroup with scroller:

      <s:Scroller id="scroller" width="100" height="100">

             <s:VGroup id="vp" width="100%" height="100%">

                <my:TripView id="one"/>  

                <my:TripView id="two"/>

                 // if any more TripView.....




      The TripView is dynamiclly generated, so the VGroup contentHeight may much greater than viewPortHeight. Since I could drag stuff in the TripView, I want to change the vp.verticalScrollPosition when the drag stuff move to the bottom of the view so the next TripView could be in the screen. The pseudo function is following:


      private function scrollToScreen(event:DragEvent):void {

          var stageX:Number = event.localX;

          var stageY:Number = event.localY;

          // pseudo code:

          if(// almost reach the bottom of vp height) {

            // increas the vp.verticalScrollPosition so the next TripView could be in the screen





      so how to implement the pseudo code?


      Message was edited by: jasonzhuang