So, i've got three HTTPService calls for three different XML files:
<mx:HTTPService id="projectsHttp" url="projects.xml" resultFormat="e4x" makeObjectsBindable="true" result="countProjects(event)" />
<mx:HTTPService id="studentsHttp" url="students.xml" resultFormat="e4x" makeObjectsBindable="true" result="createStudentsCollection(event)" />
<mx:HTTPService id="dprepHttp" url="directorsPrep.xml" resultFormat="e4x" makeObjectsBindable="true" result="createPhase(event)" />
The first two work great... but that last one just won't work. For testing purpose, the createPhase function looks like this:
public function createPhase(e:ResultEvent):void
{
Alert.show("Testing");
}
Also, the directorsPrep.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<directorspreps>
<directorsprep>
<prepid>1</prepid>
<title>dir. prep. 1</title>
<workingtitle>dp1 WT</workingtitle>
<startdate>7/7/2011</startdate>
<numdays>2</numdays>
<positions>
<role>1D</role>
<role>2D</role>
<role>1C</role>
</positions>
</directorsprep>
<directorsprep>
<prepid>2</prepid>
<title>dir. prep. 2</title>
<workingtitle>dp2 WT</workingtitle>
<startdate>7/10/2011</startdate>
<numdays>3</numdays>
<positions>
<role>1D</role>
<role>2D</role>
<role>1C</role>
<role>GE</role>
</positions>
</directorsprep>
</directorspreps>
Anybody see anything that would prevent the directorsPrep.xml file from not loading?
EDIT: I'm a moron... Didn't do the .send(); :( Sorry for the time waster
It is tough to say for sure. I created a little project in Flex3 that includes your XML file and it worked fine for me. You should add a fault
handler to know why it is failing. Put a breakpoint in that handler if you need to examine things. Also, make sure that you are calling send()
in order for that XML file to get loaded. Here is an example of what was working for me (including the fault handler).
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
public function createPhase(e:ResultEvent):void
{
Alert.show(e.result.toString());
}
protected function createPhaseFailed(e:FaultEvent):void
{
Alert.show(e.message.toString());
}
]]>
</mx:Script>
<mx:HTTPService id="dprepHttp" url="directorsPrep.xml" resultFormat="e4x" makeObjectsBindable="true"
result="createPhase(event)" fault="createPhaseFailed(event)" />
<mx:initialize>
<![CDATA[
dprepHttp.send();
]]>
</mx:initialize>
</mx:Application>
Good luck!