2 Replies Latest reply on Feb 28, 2010 9:11 AM by venkatsyss

    Regarding - ComboBoxValues Display

    venkatsyss

      hi,

       

      My  question is,

       

      I have to display the username in the combo Box .If the  user is selected a username in the Combobox i have to  display all the values in the text input.

       

      I tried in the above manner but i could not able to get it.

       

      <mx:states>
           <mx:State name="eShow">
               <mx:AddChild>
                   <mx:Panel>
                       <mx:TextInput id="temp">
                          
                       </mx:TextInput>
                   </mx:Panel>
               </mx:AddChild>
           </mx:State>
      </mx:states>

       

      //this function is have called in the combo box in the change mwthod.

      private function show(event:Event):void{
                         
                   currentState="eShow";
                   temp.text=event.currentTarget.selectedItem.username;
                
               }

       

      But i could not able to show the corresponding value in the textinput.

       

      Please find me the solutions to solve the problem.

       

      Thanks and Regards,

      venkat.R

        • 1. Re: Regarding - ComboBoxValues Display
          Gregory Lafrance Level 6

          Doing this with states can be tricky. Might be better to do it as follows:

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
              <![CDATA[
                import mx.collections.ArrayCollection;
                
                [Bindable] private var ac:ArrayCollection = new ArrayCollection([
                  {username: "bob"}, {username: "ted"}, {username: "sam"}   
                ]);
              
                private function show(event:Event):void{
                  temp.text=event.currentTarget.selectedItem.username;
                  myPanel.visible=true;
                  myPanel.includeInLayout=true;
                }
              ]]>
            </mx:Script>
            <mx:ComboBox dataProvider="{ac}" change="show(event)"
              labelField="username"/>
            <mx:Panel id="myPanel" visible="false" includeInLayout="false">
              <mx:TextInput id="temp"/>
            </mx:Panel>
          </mx:Application>
          
          

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services

          • 2. Re: Regarding - ComboBoxValues Display
            venkatsyss Level 1

            hi,

             

            Thanks for your kind reply.i got it the answer.

             

            Thanks  a lot.

             

            Thanks and Regards,

            venkat.R