Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-16-2009, 07:33 PM   #1
Registered User
Join Date: Nov 2009
Posts: 1
Default XML data from webservice to combo

I've got a bindable arraycollection in my Application which I use in 2 different places.
I can't seem to get the combo to populate properly. The webservice brings back the results in the resultHandler but they are presented as one item in xml format:

so if the "geonames" webservice is called with ta.text="BA14"
as follows:
<mx:HTTPService id="postalCodeSearch" url="http://ws.geonames.org/postalCodeSearch?" requestTimeout="10"
     	useProxy="false" method="GET" showBusyCursor="false" resultFormat="e4x"  result="resultHandler(event)" fault="FaultHandler(event)">
   <mx:request xmlns="">

private function resultHandler(evt:ResultEvent):void
   Application.application.postal_ac = new ArrayCollection(mx.utils.ArrayUtil.toArray(evt.result))

private function lfx(item:Object):String 
  var a:String = item.code.name
  trace (a)
  return  a 

<mx:ComboBox id="cb1" x="113" y="2" dataProvider="{Application.application.postal_ac}" width="158" close="closeHandler(event)" labelFunction="lfx"  ></mx:ComboBox>

One big chunk returned as a combobox item not 13 separate items and the <name/> tags are not removed.... 
<name>Trowle Common</name>
<name>Ashton Common</name>
<name>Steeple Ashton</name>
<name>Great Hinton</name>
<name>North Bradley</name>
<name>West Ashton</name>
any ideas?
Thanks in advance.
kevinyeandel is offline   Reply With Quote
Old 12-16-2009, 07:40 PM   #2
Holosuit User
wvxvw's Avatar
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,301
Send a message via ICQ to wvxvw

Any reason why would you use Application.application and ArrayCollection?
Why not feed the XMLList to both combo boxes you have?

Besides, I'm not sure ArrayUtil.toArray() will convert XML to Array - at least I wouldn't expect it to do it...
One more thing - even though it is OK to refer to the class by it's fully qualified name - in practice that would usually suggest that you have 2 classes with identical names i.e.:
and some:
which, in general is supposed to be a bad practice...
One more thing - even though AS3 allows you to omit semicolons - that's a very bad style, and, some times the compiler isn't able to cope with such syntax - so, put the semicolons - it really doesn't hurt and makes your code more readable.
The .NET open source editor for Flash and web developers
*This would be my contribution to the project*
couchsurfing if you need it
wvxvw is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 11:33 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.