1somniac
09-09-2007, 10:56 PM
Hi,
I am trying build an RSS reader from an adobe tutorial (http://labs.adobe.com/wiki/index.php/AIR:Articles:Building_Your_First_Flex-based_Adobe_AIR_Application). This reader can read the RSS given by adobe works as example, but most of the RSS doesn't and I don't know why.
Here is the code in my Main file
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}
]]>
</mx:Script>
<mx:HTTPService id="RssService" url="http://weblogs.macromedia.com/mxna/xml/rss.cfm?query=byMostRecent"
result="rssHandler(event)"/>
<!--For displaying data -->
<mx:TabNavigator
id="ContentNavigator"
width="860" height="540"
x="10" y="10" paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5">
<mx:VBox label="Articles"
width="100%" height="100%"
verticalGap="0" paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10">
<mx:Box width="100%" height="33"
backgroundColor="#B8AF9C" cornerRadius="15" paddingBottom="5" paddingLeft="10" paddingRight="5" paddingTop="5">
<mx:Button label="Fetch RSS" click="RssService.send();RssLoader.height=30"/>
</mx:Box>
<mx:Box id="RssLoader"
width="100%" height="0"
backgroundColor="#B8AF9C" paddingTop="6" paddingRight="10" paddingBottom="5" paddingLeft="10">
<mx:ProgressBar id="rssProgress"
indeterminate="true"
barColor="#B8AF9C"
width="100%"
labelPlacement="center"
label="loading feed"/>
</mx:Box>
<mx:TileList id="FeedDisplay"
width="100%" height="100%"
maxColumns="1"
rowHeight="120" columnWidth="810"
itemRenderer="ItemRenderer"
dataProvider="{rssFeedData}"/>
</mx:VBox>
</mx:TabNavigator>
</mx:Application>
Here is the ItemRenderer file :
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:DateFormatter id="dateFormatter" formatString="D-MMM-YY"/>
<mx:Text id="Title"
htmlText="{data.title}"
x="5" y="0"
fontSize="11" selectable="false"
width="780"
textAlign="left" fontWeight="bold"/>
<mx:Text id="PublishDate"
text="{dateFormatter.format(data.date)}"
x="5" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left"
fontWeight="bold"/>
<mx:Text id="Author"
text="{data.creator}"
x="68" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left" fontWeight="bold"/>
<mx:LinkButton id="ReadArticle"
label="> read article"
x="700" y="{Title.height-3}"
fontSize="10"
rollOverColor="#B8AF9C"
selectionColor="#595341"
textRollOverColor="#FFFFFF"
textSelectedColor="#FFFFFF"/>
<mx:Text id="Description"
htmlText="{data.description}"
x="5" y="{Title.height+20}"
fontSize="10" selectable="false"
width="780"
textAlign="left"/>
<mx:HRule x="0" y="115" width="100%"/>
</mx:Canvas>
I have this error message :
TypeError: Error #1010: A term is undefined and has no properties.
the error is located in this function :
[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}
Why would a term being undefined for some RSS data and not for other ?:confused:
Does any of you have an idea to handle it ?
thank you
I am trying build an RSS reader from an adobe tutorial (http://labs.adobe.com/wiki/index.php/AIR:Articles:Building_Your_First_Flex-based_Adobe_AIR_Application). This reader can read the RSS given by adobe works as example, but most of the RSS doesn't and I don't know why.
Here is the code in my Main file
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}
]]>
</mx:Script>
<mx:HTTPService id="RssService" url="http://weblogs.macromedia.com/mxna/xml/rss.cfm?query=byMostRecent"
result="rssHandler(event)"/>
<!--For displaying data -->
<mx:TabNavigator
id="ContentNavigator"
width="860" height="540"
x="10" y="10" paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5">
<mx:VBox label="Articles"
width="100%" height="100%"
verticalGap="0" paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10">
<mx:Box width="100%" height="33"
backgroundColor="#B8AF9C" cornerRadius="15" paddingBottom="5" paddingLeft="10" paddingRight="5" paddingTop="5">
<mx:Button label="Fetch RSS" click="RssService.send();RssLoader.height=30"/>
</mx:Box>
<mx:Box id="RssLoader"
width="100%" height="0"
backgroundColor="#B8AF9C" paddingTop="6" paddingRight="10" paddingBottom="5" paddingLeft="10">
<mx:ProgressBar id="rssProgress"
indeterminate="true"
barColor="#B8AF9C"
width="100%"
labelPlacement="center"
label="loading feed"/>
</mx:Box>
<mx:TileList id="FeedDisplay"
width="100%" height="100%"
maxColumns="1"
rowHeight="120" columnWidth="810"
itemRenderer="ItemRenderer"
dataProvider="{rssFeedData}"/>
</mx:VBox>
</mx:TabNavigator>
</mx:Application>
Here is the ItemRenderer file :
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:DateFormatter id="dateFormatter" formatString="D-MMM-YY"/>
<mx:Text id="Title"
htmlText="{data.title}"
x="5" y="0"
fontSize="11" selectable="false"
width="780"
textAlign="left" fontWeight="bold"/>
<mx:Text id="PublishDate"
text="{dateFormatter.format(data.date)}"
x="5" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left"
fontWeight="bold"/>
<mx:Text id="Author"
text="{data.creator}"
x="68" y="{Title.height+3}"
fontSize="9" selectable="false"
width="200"
textAlign="left" fontWeight="bold"/>
<mx:LinkButton id="ReadArticle"
label="> read article"
x="700" y="{Title.height-3}"
fontSize="10"
rollOverColor="#B8AF9C"
selectionColor="#595341"
textRollOverColor="#FFFFFF"
textSelectedColor="#FFFFFF"/>
<mx:Text id="Description"
htmlText="{data.description}"
x="5" y="{Title.height+20}"
fontSize="10" selectable="false"
width="780"
textAlign="left"/>
<mx:HRule x="0" y="115" width="100%"/>
</mx:Canvas>
I have this error message :
TypeError: Error #1010: A term is undefined and has no properties.
the error is located in this function :
[Bindable] private var rssFeedData:ArrayCollection;
private function rssHandler(event:ResultEvent):void
{
rssFeedData = event.result.RDF.item;
}
Why would a term being undefined for some RSS data and not for other ?:confused:
Does any of you have an idea to handle it ?
thank you