Actionscript & PHP Development

Building apps using Adobe Air, Actionscript 3 and PHP

By
Warning: file_get_contents(http://maps.googleapis.com/maps/api/geocode/json?latlng=,&sensor=false): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home1/foncused/public_html/dev/wp-content/plugins/google-seo-author-snippets/microdata_form.php on line 228

Warning: file_get_contents(http://maps.googleapis.com/maps/api/geocode/json?latlng=,&sensor=false): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home1/foncused/public_html/dev/wp-content/plugins/google-seo-author-snippets/microdata_form.php on line 228
Richard Mackenzie

Build native RSS/XML Reader app for your IOS/Android device

RSS for IOSThis tutorial will help you build an IOS application using Adobe AIR that can read an RSS feed from your site. As I am sure you know already an RSS feed is simply an XML file.

Flash works great with XML, so first step is to load the URL using the URL loader class.

var my_xmlData:XML = new XML();

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
 
xmlLoader.load(new URLRequest("http://yoururlhere/listing/content/rss/"));
 
									

Then we listen out for the when the loading is complete then fire off a function, which loads our XML data into flash so we can work with it.

function LoadXML(e:Event):void {

my_xmlData = new XML(e.target.data);
pullFeed(my_xmlData);

}
									

Once that is done we call our next function and pass through our XML data

function pullFeed(rss:XML):void {

trace("XML");

////// shows everything
trace(my_xmlData);

//// shows specific entry  
trace(my_xmlData.channel.link);

}
									

If you look at the above line of code “trace(my_xmlData);” this will output everything in our XML file. Then this line of code “trace(my_xmlData.channel.link);” will output the specific value located in the xml file, then the channel section then the link section.

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Content</title>
    <link>http://www.zalebs.com/listing/content/</link>
    <description/>
    <atom:link href="http://www.zalebs.com/listing/content/rss/" rel="self"/>
    <language>en-us</language>
    <lastBuildDate>Fri, 19 Jul 2013 12:22:14 -0000</lastBuildDate>
    <item>
      <title>Outstanding Personality of Siamese Cats</title>
      <link>http://www.zalebs.com/post/outstanding-personality-of-siamese-cats/</link>
      <description>If you going to own a cat, make the best choice by getting a Siamase. They are cats quite like no other breed. Read further to find out why...</description>
      <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Susana Quintal</dc:creator>
      <guid>http://www.zalebs.com/post/outstanding-personality-of-siamese-cats/</guid>
      <enclosure url=031_1_modelbase_list_item_ipod_web.jpg" length="1510300" type="image/jpeg"/>
    </item>
...
									

Then above you can view the RSS feed I was working with, my IOS application pulls this feed into it and shows the latest content from the site on it.