<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web News &#187; Flex</title>
	<atom:link href="http://gogo.org.ua/tag/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://gogo.org.ua</link>
	<description></description>
	<lastBuildDate>Tue, 08 Dec 2009 06:00:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New technology &#8211; Flex.</title>
		<link>http://gogo.org.ua/new-technology-flex</link>
		<comments>http://gogo.org.ua/new-technology-flex#comments</comments>
		<pubDate>Fri, 03 Apr 2009 16:30:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://gogo.org.ua/new-technology-flex</guid>
		<description><![CDATA[New technology &#8211; Flex.  
&#160;
Here&#8217;s what our Flex Application will look like:
 

&#160;
 
How does the example work?
 When you click the Load Blog Entries button my RSS feed entries are loaded into the datagrid. When you click on a row in the datagrid the corresponding entry is loaded into the text area.
&#160;
&#160;Valant actively [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><font face="trebuchet ms,geneva" size="5"><strong>New technology &#8211; Flex.</strong></font><br /> <font face="trebuchet ms,geneva" size="5"><strong> </strong></font></p>
<p><font face="trebuchet ms,geneva" size="3">&nbsp;</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3">Here&#8217;s what our Flex Application will look like:</font></p>
<p> 
<p style="text-align: center"><img src="http://www.petefreitag.com/images/blog/flex-blog-reader.gif" border="0" alt="flex blog reader screen shot" /></p>
<p style="text-align: center">&nbsp;</p>
<p> 
<p align="justify"><font face="trebuchet ms,geneva" size="3">How does the example work?</p>
<p> When you click the Load Blog Entries button my RSS feed entries are loaded into the datagrid. When you click on a row in the datagrid the corresponding entry is loaded into the text area.</font></p>
<p align="justify">&nbsp;</p>
<p align="center"><font face="trebuchet ms,geneva" size="4">&nbsp;<a href="http://valant.com.ua" target="_blank" title="valant">Valant</a> actively uses this technology in development.</font></p>
<p><span id="more-86"></span></p>
<p> 
<p align="justify">&nbsp;</p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>Step 1</strong></font> <font face="trebuchet ms,geneva" size="3">- XML and Application declaration</font>.</p>
<p> <font face="trebuchet ms,geneva" size="3">Start your XML file with a XML declaration, and an mx:Application tag:</font> </p>
<blockquote><p>&lt;?xml version=&quot;1.0&quot; ?&gt;</p>
<p> &lt;mx:Application xmlns:mx=&quot;http://www.macromedia.com/2003/mxml&quot;&gt; </p></blockquote>
<p><font face="trebuchet ms,geneva" size="3"><br /> </font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>Step 2</strong> &#8211; Define your HTTPService</font>.</p>
<p> <font face="trebuchet ms,geneva" size="3">Our first step is to define the HTTPService that we will use to connect to my RSS feed. We will give an id of httpRSS so we can refer back to it.</font> </p>
<blockquote><p>&lt;mx:HTTPService id=&quot;httpRSS&quot; url=&quot;http://www.petefreitag.com/rss/&quot; resultFormat=&quot;object&quot; /&gt; </p></blockquote>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>Step 3</strong> &#8211; Enclose your controls within a panel.</p>
<p> A panel is simply a container to put controls (the DataGrid, TextArea, and Button) into. We are going to set some attributes on the panel as well, it should be pretty easy to figure out what they mean:<br /> </font></p>
<blockquote><p>&lt;mx:Panel id=&quot;reader&quot; title=&quot;Pete Freitag&#8217;s Blog Reader&quot; width=&quot;500&quot;&gt; </p></blockquote>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>Step 4 </strong>- Define your DataGrid.</p>
<p> We are using the DataGrid component to display the list of blog entries in my RSS feed, along with their date.</p>
<p> This step is probably the most complicated step because we have to bind our RSS xml data to the datagrid, and define an event handler when the rows are clicked.</p>
<p> In the attributes of the DataGrid we are using dynamic variables or expressions denoted by the curly braces {variable}.<br /> </font></p>
<blockquote><p>&lt;mx:DataGrid id=&quot;entries&quot; width=&quot;{reader.width-15}&quot; dataProvider=&quot;{httpRSS.result.rss.channel.item}&quot; cellPress=&quot;{body.htmlText=httpRSS.result.rss.channel.item[entries.selectedIndex].<br /> description}&quot;&gt;<br /> &nbsp; &lt;mx:columns&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;mx:Array&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:DataGridColumn columnName=&quot;title&quot; headerText=&quot;Title&quot; /&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:DataGridColumn columnName=&quot;pubDate&quot; headerText=&quot;Date&quot; /&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;/mx:Array&gt;<br /> &nbsp; &lt;/mx:columns&gt;&nbsp;&nbsp;&nbsp;<br /> &lt;/mx:DataGrid&gt; </p></blockquote>
<p align="justify"><font face="trebuchet ms,geneva" size="3">Ok so there is a lot going on there, first so I&#8217;ll break it down a bit:</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><br /> <strong>width</strong></p>
<p> We are setting the width dynamically based on the size of its parent panel reader, specifically we set it to be 15 pixels narrower than its panel.</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong><br /> dataProvider</strong></p>
<p> In the dataProvider attribute we are binding the data for this grid to the result of our HTTPService named httpRSS. More specifically we want to bind each item tag in our XML file to a row in the datagrid. Since the item tags are inside the rss and channel tags we refer to it the array of items as httpRSS.result.rss.channel.item.</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong><br /> cellPress</strong></p>
<p> Next we want to create an event handler that will display the contents of the description tag inside the item that is clicked on. Using the variable entries.selectedIndex we know which item was clicked on, and we can refer to the description (the entry body) of that item as: httpRSS.result.rss.channel.item[entries.selectedIndex].description.</p>
<p> Now we just need to set the value of our TextArea which we will define in the next step to the rss item description, so we simply assign that value to the htmlText property of the TextArea (whose name will be body).</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><br /> <strong>columns</strong><br /> </font></p>
<p><font face="trebuchet ms,geneva" size="3"><br /> </font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3">Now we need to define which columns we are to display in the datagrid. The columnName must match the tag name that we want it to correspond to.</font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>Step 5</strong> &#8211; Define the TextArea</font>.</p>
<p align="justify"> <font face="trebuchet ms,geneva" size="3">Use the mx:TextArea tag to define the text area where the entry body will go:</font> </p>
<blockquote><p>&lt;mx:TextArea id=&quot;body&quot; editable=&quot;false&quot; width=&quot;{reader.width-15}&quot; height=&quot;300&quot; /&gt; </p></blockquote>
<p><font face="trebuchet ms,geneva" size="3"><strong><br /> </strong></font></p>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong><font face="trebuchet ms,geneva">Step 6 </font></strong></font><font face="trebuchet ms,geneva">- Create a Button.</font></p>
<p align="justify"> <font face="trebuchet ms,geneva" size="3">Our last control to define is a Button which will simply tell the HTTPService to make the request.</font> </p>
<blockquote><p>&lt;mx:Button label=&quot;Load Blog Entries&quot; click=&quot;{httpRSS.send()}&quot; /&gt; </p></blockquote>
<p align="justify"><font face="trebuchet ms,geneva" size="3">In the click event handler we call the send() method on our HTTPService object.</font></p>
<p> <font face="trebuchet ms,geneva" size="3"><strong>Step 7</strong> &#8211; Close Panel and Application.</font></p>
<p> <font face="trebuchet ms,geneva" size="3">Simply close some tags, and your done!</font> </p>
<blockquote><p>&lt;/mx:Panel&gt;<br /> &lt;/mx:Application&gt; </p></blockquote>
<p align="justify"><font face="trebuchet ms,geneva" size="3"><strong>One Caveat</strong></font></p>
<p> <font face="trebuchet ms,geneva" size="3">Flex 1.5 uses a proxy to invoke HTTPService calls, and other remote service calls, and for security reasons the proxy will block the HTTP call. You add the RSS feed url (or simply http://*) to the proxy whitelist in your flex-config.xml. See this KB article for more info.</font><br /> <font face="trebuchet ms,geneva" size="3">Complete MXML source code:</font><br /> <br />
<blockquote>&lt;?xml version=&quot;1.0&quot; ?&gt;</p>
<p> &lt;mx:Application xmlns:mx=&quot;http://www.macromedia.com/2003/mxml&quot;&gt;</p>
<p> &nbsp;&lt;mx:HTTPService id=&quot;httpRSS&quot; url=&quot;http://www.petefreitag.com/rss/&quot; resultFormat=&quot;object&quot; /&gt;</p>
<p> &nbsp;&lt;mx:Panel id=&quot;reader&quot; title=&quot;Pete Freitag&#8217;s Blog Reader&quot; width=&quot;500&quot;&gt;</p>
<p> &nbsp; &lt;mx:DataGrid id=&quot;entries&quot; width=&quot;{reader.width-15}&quot; dataProvider=&quot;{httpRSS.result.rss.channel.item}&quot; cellPress=&quot;{body.htmlText=httpRSS.result.rss.channel.item[entries.selectedIndex].<br /> description}&quot;&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;mx:columns&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:Array&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:DataGridColumn columnName=&quot;title&quot; headerText=&quot;Title&quot; /&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:DataGridColumn columnName=&quot;pubDate&quot; headerText=&quot;Date&quot; /&gt;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/mx:Array&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;/mx:columns&gt;&nbsp;&nbsp;&nbsp;<br /> &nbsp; &lt;/mx:DataGrid&gt;</p>
<p> &nbsp; &lt;mx:TextArea id=&quot;body&quot; editable=&quot;false&quot; width=&quot;{reader.width-15}&quot; height=&quot;300&quot; /&gt;</p>
<p> &nbsp; &lt;mx:Button label=&quot;Load Blog Entries&quot; click=&quot;{httpRSS.send()}&quot; /&gt;<br /> &nbsp;<br /> &nbsp;&lt;/mx:Panel&gt;</p></blockquote>
<p> 
<p align="right">&nbsp;</p>
<p align="right"><a href="http://valant.com.ua" target="_blank" title="valant"><font face="trebuchet ms,geneva" size="4">valant </font></a> </p>
<a href='javascript: void(0);' onclick="window.open('http://gogo.org.ua/wp-content/plugins/email_post/email_post_process_link.php?&email_post_link_id=86','popup_mailform',
    'toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0,width=630,height=600, top=0, left=0')"><img src='http://gogo.org.ua//wp-content/plugins/email_post/email_post.gif' style='border: 0px none;' /></a>&nbsp;<a href='javascript: void(0);' onclick="window.open('http://gogo.org.ua/wp-content/plugins/email_post/email_post_process_link.php?&email_post_link_id=86','popup_mailform',
    'toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0,width=630,height=600, top=0, left=0')">Mail this post</a>
<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/application' rel='tag' target='_self'>application</a>, <a class='technorati-link' href='http://technorati.com/tag/Flex' rel='tag' target='_self'>Flex</a>, <a class='technorati-link' href='http://technorati.com/tag/XML' rel='tag' target='_self'>XML</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://gogo.org.ua/new-technology-flex/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

