3 Replies Latest reply on Mar 4, 2013 8:43 AM by DeanLoganBH

    Spinner list data

    fsoender Level 1

      When I choose a item in the spinner list, where are this data stored?

       

       

       

      <s:SpinnerListContainer x="173" y="72" width="133" height="109">

                    <s:SpinnerList width="118" height="100%" labelField="data" selectedIndex="1">

                           <s:ArrayList>

                                 <fx:Object data="Test 1"></fx:Object>

                                 <fx:Object data="Test 2"></fx:Object>

                                 <fx:Object data="Test 3"></fx:Object>

                                 <fx:Object data="Test 4"></fx:Object>

                           </s:ArrayList>

                    </s:SpinnerList>

      </s:SpinnerListContainer>

        • 1. Re: Spinner list data
          DeanLoganBH Level 3

          In your example, in the spinner itself.

           

          Here is the example from the documentation.

          <s:SpinnerList id="spinner3" typicalItem="XXX" wrapElements="false"

                                     fontWeight="bold" textAlign="center"

                                     change="handleSelectionChange(event)">

                          <s:dataProvider>

                              <s:ArrayList>

                                  <fx:String>AM</fx:String>

                                  <fx:String>PM</fx:String>

                              </s:ArrayList>

                          </s:dataProvider>

          </s:SpinnerList>

          1 person found this helpful
          • 2. Re: Spinner list data
            fsoender Level 1

            Where is the data shosen stored in this spinner list, and how can I use the data in an "IF" statement?

            Cant find this in my actionscript book or on internet.

            Like this:

             

            if  = 1

            elseif = 2

            ....

             

            <s:SpinnerListContainer x="22" y="85" width="135" height="110">

              <s:SpinnerList id="ToolSpinnerLeft" width="125" change="ToolSpinnerLeft_changeHandler(event)"

                    fontWeight="bold" labelField="data" selectedIndex="1">

               <s:dataProvider>

                <s:ArrayList>

                 <fx:String>1</fx:String>

                 <fx:String>2</fx:String>

                 <fx:String>3</fx:String>

                 <fx:String>4</fx:String>

                 <fx:String>5</fx:String>

                </s:ArrayList>

               </s:dataProvider>

              </s:SpinnerList>

            </s:SpinnerListContainer>

            • 3. Re: Spinner list data
              DeanLoganBH Level 3

              From what I think you are asking is, how do you get the selected item in order to do an action based on that selection.

               

               

              var selectedValue:String = ToolSpinnerLeft.value;
              

               

              Of course, to make things a litte easier for you, you coud change the Spinner list times to numeric

                <s:ArrayList>  
                   <fx:Number>1</fx:Number>
                   <fx:Number>2</fx:Number>
                   <fx:Number>3</fx:Number>
                   <fx:Number>4</fx:Number>
                   <fx:Number>5</fx:Number>
                 </s:ArrayList>
              

               

              Or, more simply, just have a minimum and maximum for your SpinnerList by using a NumericDataProvider

               

              <s:SpinnerList typicalItem="100">
                  <s:dataProvider>
                      <s:NumericDataProvider minimum="1" maximum="5" stepSize="1"/>
                  </s:dataProvider>
              </s:SpinnerList>
              

              Then when you get the ToolSpinnerLeft.value; it will already be a number for the Switch example I gave in your other post.