如何制作水平SpinnerList

时间:2012-05-26 07:38:21

标签: flash-builder

我在我的应用程序中使用SpinnerList,默认情况下它具有垂直布局。但是我需要Horizo​​ntal SpinnerList。

我尝试了旋转,方向,但无法制作水平微调器列表。

<s:titleContent>
   <s:SpinnerListContainer direction="ltr"    autoLayout="true">
     <s:SpinnerList id="titleSpinner" textAlign="center">
        <s:ArrayList>
             <fx:String>First</fx:String>
             <fx:String>Second</fx:String>
             <fx:String>Third</fx:String>
             <fx:String>Fourth</fx:String> 
             <fx:String>Fifth</fx:String>
        </s:ArrayList>
      </s:SpinnerList>
   </s:SpinnerListContainer>
</s:titleContent>

请指导我。

1 个答案:

答案 0 :(得分:0)

<s:Scroller id="scrllr" focusEnabled="false"
                    hasFocusableChildren="true"
                    width="100%">
            <s:HGroup id="hg" gap="20"
                      paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5">
                <s:Label text="First" color="White"
                     focusIn="textinput_focusInHandler(event)"/>
                <s:Label text="Second" color="White"
                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Third" color="White"
                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Fourth" color="White"
                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Fifth" color="White"
                     focusIn="textinput_focusInHandler(event)" />
                <s:Label text="Sixth" color="White"
                     focusIn="textinput_focusInHandler(event)" />
            </s:HGroup>
        </s:Scroller>


protected function textinput_focusInHandler(evt:FocusEvent):void
            {
                var idx:int = hg.getElementIndex(evt.target as IVisualElement);
                var lay:HorizontalLayout =  hg.layout as HorizontalLayout;
                if(lay.fractionOfElementInView(idx)<1)
                {
                    lay.horizontalScrollPosition +=lay.getScrollPositionDeltaToElement(idx).y;
                }
            }