7 Replies Latest reply on Sep 1, 2010 10:19 PM by Flex harUI

    Question about DropDownList


      Greetings all.


      I posted this over in the "Flex Learning Paths" section two days ago and I didn't receive a reply, so I'm hoping that cross-posting it here will bring about a better result.


      I  have my first Flex app calling a Java backend, and the connection works  fine.  I have a method "getContinents()" in Java, which returns a List  of Continent objects.  Each Continent object has two variables, "name"  and "description".  "Name" is a two-letter abbreviation (NA for North  America, SA for South America, etc; you get the idea) and "Description"  is the spelled-out description (like "North America").  I have an  ActionScript class which mimics the Java class.


      In Flex, I  have a DataGrid which has, as its dataProvider, a Bindable  ArrayCollection.  When the data comes back into Flex, I put it in the  aforementioned Bindable ArrayCollection.  That works great.  The list of  Continents appears in the DataGrid, as expected.


      The  issue is the DropDownList.  I want to see the same thing happen in the  DropDownList.  I want to see the Description in the DropDownList, and  when one is chosen, based on the selection, I want to go back to the  server to get the list of Countries in that selected Continent.  But I  can't get this to happen because I can't get past a compiler error on  the DropDownList:

      -1067: Implicit coercion of a value of type String to an unrelated type mx.collections:IList.


      DropDownList is defined like this:

          <s:DropDownList x="270" y="220" id="continentDropdown" width="112">


      Data is returned to Flex in this result handler:

                  protected function continentsRO_resultHandler(event:ResultEvent):void
                  {    log.info("Returned in result handler") ;
                      continentArray=event.result as ArrayCollection ;



      When  I create a ComboBox instead of a DropDownList, I get the same compiler  error.  When I change the ComboBox from a Spark ComboBox to an MX  ComboBox, I don't get the compiler error, but the ComboBox never has any  data in it.


      Would anyone be able to tell me what it is that I am doing wrong here?


      Thanks very much in advance!!!