Skip navigation
Currently Being Moderated

how to change IViewPort verticalScrollPosition programmatically

May 1, 2013 6:44 AM

Tags: #actionscript_3.0 #flex4

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


More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points