Listing 1

<mx:HTTPService
    id="hs"
    url=" http://88.149.156.198/develop/rssToDb/rss.php "
    useProxy="false"
    result = "listAC = hs.lastResult.rss.channel.item as ArrayCollection" >

     <mx:request xmlns="">
     <qty>{myCombo.value}</qty>
     </mx:request>
      </mx:HTTPService>

    <mx:HTTPService id="addBlog"
    url="http://88.149.156.198/develop/rssToDb/add.php"
    useProxy="false"
    method="POST"
    result="blogAddedHandler(event)"
    fault="faultHandler(event)">
   <mx:request xmlns="">

   <blog_name>{frm_name.text}</blog_name>
   <url_blog>{frm_url.text}</url_blog>

   </mx:request>
   </mx:HTTPService>

Listing 2

    <mx:Script>
    	<![CDATA[
    		import mx.collections.ArrayCollection;
    		import mx.rpc.events.ResultEvent;

    			// This is the ArrayCollection variable that store the
		     //  values returned by HTTPService's request
			[Bindable]
			private var listAC:ArrayCollection;

			// The init function is called by the combobox element.
			// It adds at the first item of the ArrayCollection named
			// myArray the value of 10

			private function init():void
			{
				myArray.addItemAt({label:"10 posts", data:"10"}, 0);


			}

			// This function is called when the user selects
			// an item from the combo box.
			// It simply calls the send() method of the HTTPService
			// with an id "hs"

			private function changeHandler():void
			{
				hs.send();
			}

			// The event handler of the HTTPService's result event
			// It makes
			// the text input empty. Then it calls again the
			// send() method of the HTTPService

			private function blogAddedHandler(event:ResultEvent):void
			{

				frm_name.text = "";
				frm_url.text = "";
				hs.send();
				mx.controls.Alert.show ("Blog added", "HTTPService's Result Event");

			}

			// The event handler of the HTTPService's fault event
			// This is a function to handle potential errors that 
			// occur during a HTTPService request

			private function faultHandler(event:mx.rpc.events.FaultEvent):void
			{
				var faultInfo:String="fault description: "+event.fault.faultDetail+"\n\n";
				faultInfo+="fault faultstring: "+event.fault.faultString+"\n\n";
				mx.controls.Alert.show(faultInfo,"Fault Information");

			}

			
			
    	]]>
    </mx:Script>

Listing 3

    <mx:WipeLeft id="WL"/>

	<mx:Panel title="Flex 2 Blog Aggregator" >

	<mx:Image source="http://www.comtaste.com/images/logo.gif" />

	<mx:Text text="Insert the blog you want to add to your preferite list."  height="28"/>

	<mx:TabNavigator width="350" height="350">
		<mx:VBox label="Add Blog" width="100%" height="100%" showEffect="WL">
			<mx:Form width="100%">
				<mx:FormHeading label="Insert a new blog"/>
				<mx:FormItem label="Name">
					<mx:TextInput id="frm_name" />
				</mx:FormItem>
				<mx:FormItem label="URL's address">
					<mx:TextInput id="frm_url" />
				</mx:FormItem>
				<mx:HBox>
					<mx:Spacer width="50" />
					<mx:Button label="Add" id="btn_add" click="addBlog.send()" />
				</mx:HBox>

			</mx:Form>

		
		</mx:VBox>
		<mx:VBox label="View Blogs" width="90%" height="100%" showEffect="WL">

		<mx:Label text="Show the latest :" id="myLbl" fontWeight="bold"/>

		<mx:ComboBox id="myCombo" change="changeHandler()" creationComplete="init();myCombo.selectedIndex=0" >
	<mx:ArrayCollection id="myArray">
            <mx:Object label="20 posts" data="20"/>
            <mx:Object label="30 posts" data="30"/>
    </mx:ArrayCollection>
</mx:ComboBox>

		<cust:custBlogData width="100%"  lista="{hs.lastResult.rss.channel.item}" />

		</mx:VBox>

		
	</mx:TabNavigator>

	<mx:ControlBar>
		<mx:Label text="Developed by Marco Casario" />
	<mx:LinkButton label="http://casario.blogs.com" click="navigateToURL(new URLRequest('http://casario.blogs.com'),'_blank');"/>

	</mx:ControlBar>

	</mx:Panel>

</mx:Application>

Listing 4

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">

		<mx:HTTPService
    id="saveHS"
    url="http://88.149.156.198/develop/rssToDb/savenews.php"
    useProxy="false"
    method="POST"
    result="linkHandler(event)"
    fault="faultHandler(event)">

     <mx:request xmlns="">
     <url>{myDG.selectedItem.link}</url>
     </mx:request>
      </mx:HTTPService>

      
	<mx:Script>
	<![CDATA[
		import mx.collections.ArrayCollection;
		import mx.rpc.events.ResultEvent;

		[Bindable]
		public var lista:ArrayCollection;
		[Bindable]
		private var counter:Number;

	private function linkHandler(event:ResultEvent):void
			{
				counter = event.result.list.total;	
				counterLbl.text = "Post saved so far : " + counter;
				mx.controls.Alert.show ("Post has been stored", "HTTPService's Result Event");

			}
			private function faultHandler(event:mx.rpc.events.FaultEvent):void
			{
				var faultInfo:String="fault description: "+event.fault.faultDetail+"\n\n";
				faultInfo+="fault faultstring: "+event.fault.faultString+"\n\n";
				mx.controls.Alert.show(faultInfo,"Fault Information");

			}

	]]>
</mx:Script>

<mx:Style>
	DataGrid {
    depthColors: #EAEAEA, #FF22CC, #FFFFFF;
    alternatingItemColors: white, gray;
}

</mx:Style>

	<mx:DataGrid id="myDG" dataProvider="{lista}" width="100%" >
		<mx:columns>
        <mx:DataGridColumn headerText="Posts" dataField="title" width="150" />
        <mx:DataGridColumn headerText="Link" dataField="link"  />

    </mx:columns>
	</mx:DataGrid>

	<mx:HBox>
		<mx:Label text="Add this news to your bookmark : " />
		<mx:Button label="Save" click="saveHS.send();" />
	</mx:HBox>

	<mx:Label id="counterLbl" />


	</mx:VBox>

Listing 5

//Link to RSS 2.0 feed
$link_to_rss_feed ="http://88.149.156.198/develop/rssToDb/rssmobile.php";

//Counter to append to &variables to return to the client
$i=1;

// This PHP 5 function loads the entire XML feed
$xml = simplexml_load_file($link_to_rss_feed);

// Parse each item in the RSS feed

foreach    ($xml->channel[0]->item as $item)
{
    if($item) {
        // Need to strip html tags since Flash Lite does not support
        // html in dynamic text fields
        $title = strip_tags($item->title);
        $description = strip_tags($item->description);

// Replace special symbols &
        $title = str_replace("&", "", $title);
        $description = str_replace("&", "", $description);

// Return the content with the appropriate index
        echo "&title$i=".$title;
        echo "&description$i=".$description;
        //echo $i;
        $i++;
    } else {
        // Send and Error message if content is not found
        echo "&msg=Content not found";
        echo "&flag=error";
        echo "&end=end";
        exit;
    }
}

$i=$i-1;
echo "&flag=ok";
echo "&totalitems=".$i;
echo "&end=end";

Listing 6

// Shifting variables
on (keyPress "<Right>") {
    if (n ne totalitems) {
        n++;
    } else {
        n = 1;
    }
    title = eval("title" add n);
    description = eval("description" add n);
}

on (keyPress "<Left>") {
    if (n ne 1) {
        n- -;
    } else {
        n = totalitems;
    }
    title = eval("title" add n);
    description = eval("description" add n);
}
//Scrolling
on (keyPress "<Up>") {
    description.scroll--;
}
on (keyPress "<Down>") {
    description.scroll++;