Hi all,
I’m trying to populate a combobox in Flex with an xml repsonse I am getting over httpservice response!
[COLOR=red]<?xml version=“1.0” encoding=“utf-8”?>
<mx:Application xmlns:mx="[/COLOR][COLOR=red]http://www.adobe.com/2006/mxml[/COLOR][COLOR=red]" layout=“absolute” xmlns:comp=“components.*” width=“460” height=“522” viewSourceURL=“srcview/index.html”>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.http.HTTPService;
import mx.utils.XMLUtil;
import mx.collections.ArrayCollection;[/COLOR]
I’ve created an arraycollection
[COLOR=red]//Array that holds the version name
[Bindable]
public var versionData:ArrayCollection ;[/COLOR]
[COLOR=#ff0000][/COLOR]
[COLOR=black]Have my HttpService method[/COLOR]
[COLOR=red]/Creates an HttpService object and executes the send method/
public function useHttpService():void {
var params:Object = new Object() ;[/COLOR]
[COLOR=red] //create an HTTPService object named service
var service:HTTPService = new HTTPService();
//set the properties of the service object
service.url = "[/COLOR][[COLOR=red]http://localhost:9080/oneClickInstall/sample/XMLAppListAction[/COLOR]](http://localhost:9080/oneClickInstall/sample/XMLAppListAction)[COLOR=red]";
service.method="get";
service.addEventListener("result", httpResult);
service.addEventListener("fault", httpFault);
service.resultFormat="e4x";
service.send(params); }
[/COLOR]
and have the following httpResult function
[COLOR=red]public function httpResult(event:ResultEvent):void {
versionData = event.result.Version.Release.attributes() as ArrayCollection;[/COLOR]
[COLOR=red]} //end function httpResult[/COLOR]
…
I then have a simple button which when pushed should populate a combobox
[COLOR=red]<mx:Panel layout=“absolute” backgroundColor="#8396a9" borderStyle=“solid” left=“10” top=“10” width=“440” height=“391” cornerRadius=“20” borderThickness=“2” borderColor="#ffffff" id=“panel1”>[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]<mx:Button x=“20” y=“10” label=“Submit” click=“useHttpService()” id=“submitBtn”/>[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]<mx:ComboBox x=“165” y=“10” dataProvider="{versionData}" id=“versionBox” prompt=“Please select a version…”/>[/COLOR]
[COLOR=red][/COLOR]
[COLOR=red]</mx:Panel>
</mx:Application>[/COLOR]
[COLOR=#ff0000][/COLOR]
[COLOR=black]This doesn’t do anything? I was wondering if anyone would have any idea how I might get this to work or if there’s any examples of populating a combobox by adding an xml httpresponse to an arraycollection?[/COLOR]
Thanks a mil in advance for any help?
Cheers,
Derm