• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Populating a Drop Down List

New Here ,
Feb 24, 2011 Feb 24, 2011

Copy link to clipboard

Copied

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();

[Bindable]

private var ddFacNum:ArrayCollection = new ArrayCollection();

private function populateFacilityNumber():void

{

getFacNum.sqlConnection = connection;

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

getFacNum.addEventListener(SQLEvent.RESULT,ongetFacNum);

getFacNum.execute();

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"

dataProvider="{ddFacNum}"

fontFamily="Arial" fontSize="16"

id="ddFacilityNumber"

prompt="Select facility number...">

</s:DropDownList>

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.

Views

961

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2011 Mar 02, 2011

Copy link to clipboard

Copied

LATEST

http://www.adobe.com/devnet/flex/videotraining.html

http://www.adobe.com/devnet/flex/flex_net.html

I haven't used .NET for data access as yet but these 2 links should give you a start.

If you were talking Coldfusion or PHP, I might be able to help but fortunately I haven't been forced to used .NET for a few years. ;o)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines