I have a new Flash Builder (Flex) project, basically it has 2 combo boxes in it. I have added a web service, the service is called uws_lookups and has 2 methods, lookupLanguage and lookupCountry.
If I bind a combobox to the result from either of these services everything works as expected, here is the code:
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:uws_lookups="services.uws_lookups.*" minWidth="955" minHeight="600"><fx:Script> <![CDATA[ import com.adobe.serializers.utility.TypeUtility; import mx.controls.Alert; import mx.events.FlexEvent; protected function comboBox_creationCompleteHandler(event:FlexEvent):void { lookupCountryResult.token = uws_lookups.lookupCountry(); } ]]></fx:Script><fx:Declarations> <s:CallResponder id="lookupCountryResult"/> <uws_lookups:Uws_lookups id="uws_lookups" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/> <!-- Place non-visual elements (e.g., services, value objects) here --></fx:Declarations><s:ComboBox id="comboBox" creationComplete="comboBox_creationCompleteHandler(event)" labelField="countryName"> <s:AsyncListView list="{TypeUtility.convertToCollection(lookupCountryResult.lastResult.Tables.Country.Rows)}"/></s:ComboBox><s:ComboBox/></s:Application>
As you can see the combobox gets bound, the results are returned and displayed, however when I bind the second box to the other method Flash Builder does the most stupid thing ever:
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:uws_lookups="services.uws_lookups.*" minWidth="955" minHeight="600"><fx:Script> <![CDATA[ import com.adobe.serializers.utility.TypeUtility; import mx.controls.Alert; import mx.events.FlexEvent; protected function comboBox_creationCompleteHandler(event:FlexEvent):void { lookupCountryResult.token = uws_lookups.lookupCountry(); } protected function comboBox2_creationCompleteHandler(event:FlexEvent):void { lookupLanguageResult.token = uws_lookups.lookupLanguage(); } ]]></fx:Script><fx:Declarations> <s:CallResponder id="lookupCountryResult"/> <s:CallResponder id="lookupLanguageResult"/> <uws_lookups:Uws_lookups id="uws_lookups" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/> <!-- Place non-visual elements (e.g., services, value objects) here --></fx:Declarations><s:ComboBox id="comboBox" creationComplete="comboBox_creationCompleteHandler(event)" labelField="countryName"> <s:AsyncListView list="{TypeUtility.convertToCollection(lookupCountryResult.lastResult.Tables.Country.Rows)}"/></s:ComboBox><s:ComboBox id="comboBox2" creationComplete="comboBox2_creationCompleteHandler(event)" labelField="LanguageName"> <s:AsyncListView list="{TypeUtility.convertToCollection(lookupLanguageResult.lastResult.Tables.Country.Rows)}"/></s:ComboBox></s:Application>
Now I'm pretty sure that isnt what I asked it to do, so I manually change the code line to read correctly
<s:AsyncListView list="{TypeUtility.convertToCollection(lookupLanguageResult.lastResult.Tables.Language.Ro ws)}"/>
Which enables to second combobox to work, but the original one (countries) now displays [Object: Language_type]
I have debugged the application and both methods do actually return the correct data, FB is just choosing to do something stupid when I add the second call.
I have done the basics, deleted the project and started again, tried a different web service, tried different methods, but it looks like when I use more than one method it fails, so please tell me, what am I doing wrong because I know Flash Builder cannot be doing this by design.
I will post the service response in another post.
Thanks for any help you have!
Shaine