In my application I want to use an array to navigate a part
of a XML file from an external XML file on web. I first use a
<mx:HTTPService> to link to the .xml file, and then create a
XML object to hold the "lastResult" in the <mx:Script> tag.
It doesn't show an error in the Flex builder, however, when I
execute the application, the system show an error message as below:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
Here are the code I used:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="creationCompleteHandler()">
<mx:Script>
<![CDATA[
public function creationCompleteHandler():void {
feedRequest.send();
}
var MyXML:XML = new XML(feedRequest.lastResult);
]]>
</mx:Script>
<mx:HTTPService id="feedRequest" url="
http://sweb.cityu.edu.hk/50685791/Adv_trialPosts.xml"useProxy="false" />
<mx:Repeater id="PostRepeator"
dataProvider="{MyXML.channel.item}">
<custom:PostPanel id="PostHolder" width="{sizeWidth}"
height="{sizeHeight}" title="{PostRepeator.currentItem.title}" >
<mx:TextArea width="100%" height="100%"
text="{PostRepeator.currentItem.title}" />
</custom:PostPanel>
</mx:Repeater>
</mx:application>
Did I missed something or got some misconceptions??
Thx a lot!