You can use the getScrollPositionDeltaToElement() function of the layout and
add the x value of the returned point to the horizontalScrollPosition.
Basically something like this (not tested):

buttonbar1.layout.horizontalScrollPosition +=
buttonbar1.layout.getScrollPositionDeltaToElement(buttonbar1.selectedIndex).x;


Haykel Ben Jemia

Allmas
Web & RIA Development
http://www.allmas-tn.com




On Tue, May 11, 2010 at 9:14 AM, bhaq1972 <[email protected]> wrote:

>
>
> I have a spark ButtonBar with a horizontalLayout. The width of the
> ButtonBar is small ...so the end buttons don't show.
> When I set the selectedIndex to one of the end buttons...its not coming
> into view.
>
> How can I ensure the selectedItem is in view?
>
> thanks
>
> <s:HGroup>
> <s:ButtonBar id="buttonbar1" width="500" requireSelection="true">
> <s:layout>
> <s:HorizontalLayout />
> </s:layout>
> <s:dataProvider>
> <s:ArrayCollection source="['Button1', 'Button2', 'Button3', 'Button4',
> 'Button5', 'Button6', 'Button7', 'Button8']" />
> </s:dataProvider>
> </s:ButtonBar>
> <s:TextInput id="t1" text="7"/>
> <s:Button label="selectIndex" click="buttonbar1.selectedIndex =
> Number(t1.text)"/>
> </s:HGroup>
>
>  
>

Reply via email to