6/16/2010 3:15:37 AM
Title:
HTTPService XML not working.
Hi All,
I've just pull out 2 XML data as http service, but one data not working..
or data not displayed on datagrid.
Could someone give me advice on this..
Thanks
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var docs2:ArrayCollection;
private function serviceHandler(event:ResultEvent):void
{
docs2=event.result.employees.employee;
}
]]>
</mx:Script>
<mx:HTTPService id="service" url="http://krntom:8080/05/data2.xml" result="serviceHandler(event)"/>
<mx:Panel title="DataGrid">
<mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{docs2}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn dataField="phone" headerText="Phone"/>
<mx:DataGridColumn dataField="email" headerText="Email"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>
and the 'data2.XML'
<?xml version="1.0"?>
<employee>
<name>Christina Coenraets</name>
<phone>555-219-2270</phone>
<email>ccoenraets@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555-219-2012</phone>
<email>jwall@fictitious.com</email>
<active>true</active>
</employee>
<employee>
<name>Maurice Smith</name>
<phone>555-219-2012</phone>
<email>maurice@fictitious.com</email>
<active>false</active>
</employee>
<employee>
<name>Mary Jones</name>
<phone>555-219-2000</phone>
<email>mjones@fictitious.com</email>
<active>true</active>
</employee>
6/16/2010 4:43:43 AM
Sorry, i've just found the solution, add this parameter in <mx:.. > statement.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="service.send();">