1 Reply Latest reply on Mar 2, 2011 7:38 PM by jeffcg2

    Populating a Drop Down List

    MikePotratz Level 1

      I'm new to using Flash Builder 4, so we'll get that out of the way immediately!


      My project uses a local database to retrieve and store information.  I've successfully created the database & can query it.  The problem I have is taking the results of that query and populating a simple dropdown list control.  All of the examples and tutorials I've seen, watched and read use either 1) local XML files for sample data or 2) a web data service to return items.  I've gone through those tutorials and trying to accomplish what I want is a piece of cake.  The "Data/Services" has no such 'connector' for local databases, so those 'techniques' don't apply...


      I've tried numerous different solutions I've found and the result is I get all sorts of errors.  This is just my latest attempt and it throws an "Error #1034: Type Coercion failed: cannot convert flash.events::SQLEvent@437fe49 to mx.rpc.events.ResultEvent" at me.  I've tried to search for the different error numbers I get and frankly, the explainations and solutions seem totally out of whack.  I've tried to incorporate them with no success.


      Using Flash Builder 4, it inserts the Spark components.  Lots of errors complain because I don't have an "mx:" component.  Changing "s:DropDownList" to "mx:DropDownList" per examples then starts throwing it's own set of unique errors in the process.


      I have had code where it doesn't throw any errors, but the dropdown list just shows [object Object] for each item returned by the query.  This code throws the error I quote above:


      private var getFacNum:SQLStatement = new SQLStatement();



      private var ddFacNum:ArrayCollection = new ArrayCollection();


      private function populateFacilityNumber():void



      getFacNum.sqlConnection = connection;

      getFacNum.text = "SELECT id_facility, facilityNumber FROM facility ORDER BY facilityNumber";



      connectionStatus.text = "Executed Query"; 

      // just show me a prompt that indicates I've gotten at least this far...


      private function ongetFacNum(e:ResultEvent):void


      ddFacNum = getFacNum.getResult().data as ArrayCollection;


      <s:DropDownList includeIn="NewInspection"


      fontFamily="Arial" fontSize="16"


      prompt="Select facility number...">



      I'm coming from a .NET developing environment and it seems that these two types of systems are vastly different.  Any and all assistance, links, pointers, whatever, would be greatly appreciated.