PDA

View Full Version : Issue with HTTPService w/PHP


dascoe
09-23-2011, 02:46 PM
I'm having an issue populating data into an Array from the HTTPService.

mxml code:
<mx:HTTPService id="srv" result="resultHandler(event)" fault="showErrorDialog(event)" method="POST"
showBusyCursor="true" url="returnLeagueInfo.php" useProxy="false" requestTimeout="0" resultFormat="e4x">

<mx:request xmlns="">
<whichid>{playerID.text}</whichid>
<season>{whichseason.text}</season>
</mx:request>

</mx:HTTPService>

private function resultHandler(event:ResultEvent):void
{
player_fname = event.result.fname;
player_lname = event.result.lname;
player_email = event.result.email;
txt_fname.text = player_fname;
txt_lname.text = player_lname;
txt_email.text = player_email;
lbl_dues_night_one.text = "first night dues: $"+leagueduesone.toString();
lbl_dues_night_two.text = "second night dues: $"+leagueduestwo.toString();
//rawCourseData = event.result.list.course.source as Array;
//rawCourseData = event.result.list.course as Array;
//rawCourseData = event.result.course.source as Array;
rawCourseData = event.result.course as Array;
arrCourseData = new Array(rawCourseData.length);
for (var i:Number = 0; i < rawCourseData.length; i++)
{
arrCourseData[i] = {name: rawCourseData[i].name, shortname: rawCourseData[i].shortname, CID: rawCourseData[i].CID, night: rawCourseData[i].night, cost: rawCourseData[i].cost, logopath: rawCourseData[i].logopath};
}
}

I have tried all the lines that are commented out and I get nothing in the Array.

I do get the information for fname, lname and email correctly.

Here's what the php file returns:
<list><fname>Myfname</fname><lname>Mylname</lname><email>[email protected]</email><course><name>Golfers Club</name><shortname>Golfers</shortname><CID>1</CID><night>3</night><cost>14</cost><logopath>/images/logos/logo_W150_070326.jpg</logopath></course><course><name>Another Golf Club</name><shortname>Another</shortname><CID>5</CID><night>2</night><cost>15</cost><logopath>/images/logos/another_golf.gif</logopath></course><course><name>Someother Golf &amp; Country Club</name><shortname>Someother</shortname><CID>11</CID><night>1</night><cost>16</cost><logopath>/images/logos/someother_logo_W150.jpg</logopath></course></list>

I'm trying to populate the Array so I can built a combobox with it.

Main Thread (Suspended: TypeError: Error #1009: Cannot access a property or method of a null object reference.)
TBGTE_Spring_League-resultHandler
TBGTE_Spring_League-__srv_result
flash.events::EventDispatcher-dispatchEventFunction [no source]
flash.events::EventDispatcher-dispatchEvent [no source]
mx.rpc.http.mxml::HTTPServiceinternal::dispatchRpc Event
mx.rpc::AbstractInvoker/internal::resultHandler
mx.rpc::Responder-result
mx.rpc::AsyncRequest-acknowledge
DirectHTTPMessageResponder-completeHandler
flash.events::EventDispatcher-dispatchEventFunction [no source]
flash.events::EventDispatcher-dispatchEvent [no source]
flash.net::URLLoader-onComplete [no source]


[SWF] /TBGTE/TBGTE_Spring_League-debug/TBGTE_Spring_League.swf - 1,352,946 bytes after decompression
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at TBGTE_Spring_League/resultHandler()[TBGTE_Spring_League.mxml:100]
at TBGTE_Spring_League/__srv_result()[TBGTE_Spring_League.mxml:114]
at flash.events::EventDispatcher-dispatchEventFunction()
at flash.events::EventDispatcher-dispatchEvent()
at mx.rpc.http.mxml::HTTPServiceinternal::dispatchRpc Event()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\ rpc\http\mxml\HTTPService.as:290]
at mx.rpc::AbstractInvoker-internal::resultHandler()[AbstractInvoker.as:193]
at mx.rpc::Responder/result()[Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[DirectHTTPChannel.as:403]
at flash.events::EventDispatcher-dispatchEventFunction()
at flash.events::EventDispatcher-dispatchEvent()
at flash.net::URLLoader-onComplete()