Check out the help docs!

I'm not sure if you mean scroll the datagrid, or scrollbars on the hbox.

DataGrid:

      scrollToIndex () method   

public function scrollToIndex(index:int):Boolean 
Ensures that the data provider item at the given index is visible. If the item 
is visible, the verticalScrollPosition property is left unchanged even if the 
item is not the first visible item. If the item is not currently visible, the 
verticalScrollPosition property is changed make the item the first visible 
item, unless there aren't enough rows to do so because the 
verticalScrollPosition value is limited by the maxVerticalScrollPosition 
property. 

HBox:

Ifyou mean the scroll bar on a HBox then use the scrollPosition property of the 
HBox scrollbar. The HBox has a scrollbar property: verticalScrollBar.

So, for your hbox it would be tile2.verticalScrollBar.scrollPosition = 0;

Paul

  ----- Original Message ----- 
  From: Paul Steven 
  To: flexcoders@yahoogroups.com 
  Sent: Tuesday, March 04, 2008 2:32 PM
  Subject: [flexcoders] How to reset a scrollbar - would really appreciate some 
assistance please


  I want to reset a scroll bar to the top when returning to a dynamically 
populated datagrid in my app. Basically the datagrid displays info about 
different students so clicking on a students name in a list takes you to this 
datagrid. Problem is if I am looking at the data of one student and scroll down 
this info, then leave this section and return as a different student, the 
scroll bar is where I left it with the previous student

   

  Here is the code of the relevant section. As no scroll bar is explicitly 
coded, I do not know how to ensure it resets.

   

  <mx:VBox width="720" id="tile2" height="190">

                                                  

              <mx:Repeater id="markSheetRepeater" 
dataProvider="{this.markSheetXMLData}" >                                        
                           

                                                                          

                          <local:MarkSheetItem 
xmlItem="{markSheetRepeater.currentItem}" id="markSheetItem">

                                                                                
                                                                              

                                      </local:MarkSheetItem>                    
                                     

                                                                          

              </mx:Repeater>         

                                                              

  </mx:VBox>               

   

  Btw this is Flexbuilder 2

   

  Thanks in advance

   

  Paul

   

Reply via email to