Well, still getting the same error.
----------------------------------------
From: "Wally Kolcz" <[email protected]>
Sent: Wednesday, January 21, 2009 9:51 AM
To: [email protected]
Subject: Re: [flexcoders] What is the resultsgeof a web service
Thanks. Totally forgot about the resultFormat. So used to using RemoteObjects,
but we have Blue Disaster(opps, Dragon) here at the U.
----------------------------------------
From: Adrian Williams <[email protected]>
Sent: Wednesday, January 21, 2009 9:47 AM
To: [email protected]
Subject: Re: [flexcoders] What is the results of a web service
Hi Wally,
Any particular reason you are not setting a resultFormat on your
mx:operation? For example:
<mx:operation name="service" resultFormat="object"
result="serviceResult(event)"/>
Adrian
Wally Kolcz wrote:
I am having fits trying to figure out how to use the information
coming back from a webservice. I created a web service call in my code:
<mx:WebService id="storyGateway"
wsdl="http://www2.med.umich.edu/prmc/media/newsroom/stories.cfc?wsdl"
fault="Alert.show(event.fault.message,'Story Gateway
Error')">
<mx:operation name="listBySubject" result="buildBookHandler(event)"
fault="Alert.show(event.fault.message,'Story Gateway
Error')" />
</mx:WebService>
It returns the data as requested, I can see it in my debugging, but I
cannot figure out how to set it to a variable and then call the various
elemenets (linkText, story, photo, defaultLogo)
I tried to set it to a variable as an ArrayCollection:
[Bindable]
public var storyFeed:ArrayCollection = new
ArrayCollection();
public function buildBookHandler(e:ResultEvent):void {
storyFeed = e.result as ArrayCollection;
for (var i:uint = 0; i < e.result.data.length;
i++){
...
//Story Area
var storyArea:TextArea = new TextArea();
storyArea.text = storyFeed.getItemAt(i).story;
storyArea.wordWrap = true;
storyArea.height = 550;
storyArea.width = 400;
storyArea.editable = false;
magPage.addChild(storyArea);
storyArea.x = 0;
storyArea.y = 25;
...
}
rssMag.flipOnClick = true;
}
But still getting errors..
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at RSSMagazine/buildBookHandler()[D:\wkolcz\My
Documents\Flex Builder 3\RSSMagazine\src\RSSMagazine.mxml:36]
Line 36 is:
storyArea.text = storyFeed.getItemAt(i).story;
Help!