Current Position:Home > HTTPService using e4x

HTTPService using e4x

Update:11-30Source: network consolidation
Advertisement
I'm trying to use HTTPService to receive xml data from a
website, using e4x, then put it in a datagrid (and do other things
with it later). I can get it to populate the datagrid using object,
but need it in xml form to use it in other places. I've tryed using
an XMLListCollection, but can't seem to get it working.
/********************* XML *******************/
<?xml version="1.0" encoding="iso-8859-1" ?>
<tool>
<projects>
<project>
<projectName>Project 1</projectName>
<active>true</active>
</project>
<project>
<projectName>Project 2</projectName>
<active>true</active>
</project>
</projects>
</tool>
/***************** This works ****************/
<mx:HTTPService id="list_request" url="myxml.xml"
showBusyCursor="true" resultFormat="object"
fault="Alert.show('Project listing could not be
retrieved!','Error');"/>
<mx:DataGrid y="0" width="508" height="291"
horizontalCenter="0"
dataProvider="{list_request.lastResult.tool.projects.project}"
id="dgProjects">
<mx:columns>
<mx:DataGridColumn headerText="Projects"
dataField="projectName"/>
</mx:columns>
</mx:DataGrid>
Thanks in advance.

The Best Answer

Advertisement
Using that I get these console warnings:
warning: unable to bind to property 'projects' on class 'XML'
(class is not an IEventDispatcher)
warning: unable to bind to property 'project' on class
'XMLList' (class is not an IEventDispatcher)
Also, I can't figure out why lastResult is returning null if
I work with it in the same function list_request was called from.
public function GotoStartPage():void{
list_request.send();
// If the query contained a value for project_request...
if(Application.application.parameters.project_request!=null){
// Check to see if the query matched one of the listed
projects
project_request=Application.application.parameters.project_request;
currentState="Main Project Page";
}else{
trace(list_request.lastResult); // <-
this gives null
project_request="";
currentState="Project Selection Screen";
Is the trace statement getting called before
list_request.send() is finished getting the data?

Database error: [Table 'ac_posts' is marked as crashed and should be repaired]

SELECT a.*, b.post_content FROM ac_posts a INNER JOIN ac_posts_content b ON a.ID = b.ID WHERE a.ID IN(4653848,1247121,1623070,3535631,240123,1578536,2886186,3535603,3535659,3535667) ORDER BY FIELD(a.ID, 4653848,1247121,1623070,3535631,240123,1578536,2886186,3535603,3535659,3535667);