Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,

I am using SpinnerList in my applicaiton and by default it has a vertical layout. But I have a requirement of Horizontal SpinnerList.

I tried rotation but that was not enough.

XML
<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>


Please guide me
Posted

1 solution

Hello I found the solution. There no horizontal Spinner List. Therefore need to make a control.

XML
<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>



C#
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;
                }
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900