<?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>FLEX{er} &#187; PHP</title>
	<atom:link href="http://www.flexer.info/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexer.info</link>
	<description>flex developers web corner</description>
	<lastBuildDate>Tue, 04 Oct 2011 16:23:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://www.flexer.info</link>
  <url>http://www.flexer.info/favicon.ico</url>
  <title>FLEX{er}</title>
</image>
		<item>
		<title>Webseminar &#8211; Debugging Flex and PHP Projects</title>
		<link>http://www.flexer.info/2010/03/21/webseminar-debugging-flex-and-php-projects/</link>
		<comments>http://www.flexer.info/2010/03/21/webseminar-debugging-flex-and-php-projects/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 19:02:29 +0000</pubDate>
		<dc:creator>Stelian Crisan</dc:creator>
				<category><![CDATA[Conferences, Meetings & Events]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex 4 SDK]]></category>
		<category><![CDATA[Flex IDE]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Eclipse PDT]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[webdeminar]]></category>
		<category><![CDATA[Xdebug]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=1503</guid>
		<description><![CDATA[Wednesday, March 24, 2010 from 12:00 AM &#8211; 1:00 PM (GMT+0200) join our friend Mihai Corlan (Platform Evangelist for Adobe) while he goes through the basics of debugging a Flex and PHP application.
See how to work with: Flash Builder 4,  Xdebug and Eclipse PDT to ensure a bug free project.
The presentation will take about 45 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2010%2F03%2F21%2Fwebseminar-debugging-flex-and-php-projects%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2010%2F03%2F21%2Fwebseminar-debugging-flex-and-php-projects%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2010/03/21/webseminar-debugging-flex-and-php-projects/&title=Webseminar+&#8211;+Debugging+Flex+and+PHP+Projects&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Wednesday, March 24, 2010 from 12:00 AM &#8211; 1:00 PM (GMT+0200) join our friend <a target="_blank" href="http://www.corlan.org">Mihai Corlan</a> (Platform Evangelist for Adobe) while he goes through the basics of debugging a Flex and PHP application.</p>
<p>See how to work with: Flash Builder 4,  Xdebug and Eclipse PDT to ensure a bug free project.</p>
<p>The presentation will take about 45 minutes, leaving 15 minutes to answer any questions you might have on this subject.</p>
<p>For registration go to <a target="_blank" href="http://flexphpdebug.eventbrite.com">http://flexphpdebug.eventbrite.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2010/03/21/webseminar-debugging-flex-and-php-projects/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Webinar: using PHP and Flash for developing Rich Internet Applications</title>
		<link>http://www.flexer.info/2009/12/01/webinar-using-php-and-flash-for-developing-rich-internet-applications/</link>
		<comments>http://www.flexer.info/2009/12/01/webinar-using-php-and-flash-for-developing-rich-internet-applications/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 12:57:11 +0000</pubDate>
		<dc:creator>Stelian Crisan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Conferences, Meetings & Events]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZendAMf]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mihai Corlan]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Roy Ganor]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend Studio 7.1m Flash Builder 4]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=1268</guid>
		<description><![CDATA[Our friend, Mihai Corlan, will host an e-seminar about PHP and Flash Platform, but let me quote him:
&#8220;On December 2nd, together with Roy Ganor from Zend Company, I will host an e-seminar about PHP and Flash Platform. We will show you how you can create a Rich Internet Application using the Flex framework, Illustrator, Flash Catalyst, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F12%2F01%2Fwebinar-using-php-and-flash-for-developing-rich-internet-applications%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F12%2F01%2Fwebinar-using-php-and-flash-for-developing-rich-internet-applications%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2009/12/01/webinar-using-php-and-flash-for-developing-rich-internet-applications/&title=Webinar:+using+PHP+and+Flash+for+developing+Rich+Internet+Applications&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Our friend, Mihai Corlan, will host an e-seminar about PHP and Flash Platform, but let me quote him:</p>
<p>&#8220;On December 2nd, together with Roy Ganor from Zend Company, I will host an e-seminar about PHP and Flash Platform. We will show you how you can create a Rich Internet Application using the Flex framework, Illustrator, Flash Catalyst, and Flash Builder 4. Then we will show you how to connect the Flex application to a PHP backend and how easy is to debug the PHP and Flex code using Zend Studio 7.1 and Flash Builder 4.&#8221;</p>
<p>For more informations and registration procedure please read Mihai&#8217;s article at <a title="www.corlan.org" href="http://corlan.org/2009/12/01/webinar-using-php-and-flash-for-developing-rich-internet-applications/" target="_blank">www.corlan.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2009/12/01/webinar-using-php-and-flash-for-developing-rich-internet-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple File Upload Using AMFPHP</title>
		<link>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/</link>
		<comments>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 01:13:07 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[AMF]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex 4 SDK]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=760</guid>
		<description><![CDATA[What is AMF and a bit of history
Action Message Format (AMF) is a compact binary format that is used to serialize ActionScript object graphs. Once serialized an AMF encoded object graph may be used to persist and retrieve the public state of an application across sessions or allow two endpoints to communicate through the exchange [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F09%2F02%2Fmultiple-file-upload-using-amfphp%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F09%2F02%2Fmultiple-file-upload-using-amfphp%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/&title=Multiple+File+Upload+Using+AMFPHP&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><h2>What is AMF and a bit of history</h2>
<p>Action Message Format (AMF) is a compact binary format that is used to serialize ActionScript object graphs. Once serialized an AMF encoded object graph may be used to persist and retrieve the public state of an application across sessions or allow two endpoints to communicate through the exchange of strongly typed data. </p>
<p>AMF was introduced in Flash Player 6 in 2001 and remained unchanged with the introduction of Actionscript 2.0 in Flash Player 7 and with the release of Flash Player 8. This version of AMF is referred to as AMF 0. In Flash Player 9, Action Script 3.0 was introduced along with a new Actionscript Virtual Machine (AVM+) &#8211; the new data types and language features made possible by these improvements prompted AMF to be updated. Given the opportunity to release a new version of AMF, several optimizations were also made to the encoding format to remove redundant information from serialized data.</p>
<h2>Why AMF?</h2>
<ol>
<li>AMF is a compact binary format which means few bits to be transferred from the server to the client. </li>
<li>Using AMF you can call methods from the server as the method would be in you Actionscript code.<br />
In my opinion these two are the main advantages of AMF. There are others advantages as well that you may find important.</li>
</ol>
<p>Some stats about AMF and its concurrent protocols available can be seen on James Ward’s Census Application (<a href="http://www.jamesward.com/census" target="_blank">http://www.jamesward.com/census</a>).</p>
<h2>What you need</h2>
<p>In order to complete this article you need the following things:</p>
<ol>
<li>Flash Builder 4 (<a href="http://labs.adobe.com/technologies/flashbuilder4" target="_blank">http://labs.adobe.com/technologies/flashbuilder4</a>) or other IDE with Flex 4 SDK</li>
<li>AMFPHP (<a href="http://www.amfphp.org" target="_blank">http://www.amfphp.org</a>)</li>
<li>Local LAMP server (ex: Zend Server Community Edition, XAMPP, WAMP, etc)</li>
</ol>
<p>Once you have those requirements satisfied we can go on. </p>
<p>At this moment the last version of AMFPHP is 1.9.</p>
<h2>Setting up the server side</h2>
<p>First of all create a folder in your <strong>htdocs</strong> or an alias so the web services, will be made available through your installed web server. In that place create a folder called <strong>webservices</strong>. Copy everything (but not the <strong>.htaccess</strong> file) that is in <strong>amf</strong> folder of the AMFPHP archive downloaded from amfphp.org to <strong>webservices</strong> folder. All your PHP web services will be in <strong>webservices/services</strong> folder.</p>
<p>Another thing to know is that you may need to put a <strong>crossdomain.xml</strong> file so the resulting swf file will be able to connect to the web services.</p>
<p>On same level with the <strong>webservices</strong> folder create <strong>_uploads</strong> folder (include the first underline). In this folder we will save our uploaded files.</p>
<p>This should be enough for now and we will go further to the next step.</p>
<h2>Creating our upload web service</h2>
<p>Create a new php file in <strong>webservices/services</strong> folder called <strong>upload.php</strong>. This will be the file that will contain our upload class and its methods and all its methods will be available in our flex upload application.</p>
<p>Create a class called <strong>upload</strong> as the file’s name. This class will have only one method named <strong>uploadFiles</strong>. </p>
<p>This method takes an object (<code>$fileData</code>) as parameter. This object contains the <strong>filename</strong> (<code>$fileData["filename"]</code>) and the file content as byte array (<code>$fileData["filedata"]</code>). The method gets those two and saves the file on the server location. It always returns true if it doesn’t crash. In case of a crash that means the file is not saved or an error is in our web service in which case we assume that the file is not saved. See <strong>upload.php</strong> bellow.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> upload <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// method saves files on the server</span>
    <span style="color: #000000; font-weight: bold;">function</span> uploadFiles<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileData</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// new file path an name</span>
        <span style="color: #666666; font-style: italic;">// to not overwrite the files we add the microtime before the file name </span>
        <span style="color: #000088;">$myFilePath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'../../_uploads/'</span><span style="color: #339933;">.</span>
            <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/[^0-9]+/&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #339933;">,</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$fileData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;filename&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// writing on the disk</span>
        <span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myFilePath</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fileData</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;filedata&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// returning response - is not used anywhere </span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>    
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Getting into the client side</h2>
<p>We will use the Spark components of the Flex 4 SDK. This will ease up a lot the development needed to finalize our application. The states will help us a lot.</p>
<p>Bellow in you can see the content of my <strong>MultipleFileUploadUsingAMFPHP</strong> project.</p>
<p><img src="http://www.flexer.info/wp-content/uploads/2009/09/figure1.png" alt="MultipleFileUploadUsingAMFPHP Flex Project" title="MultipleFileUploadUsingAMFPHP Flex Project" width="327" height="165" style="padding: 15px 0px 15px 0px" /></p>
<p>Let’s look at the attributes of <code><mx:RemoteObject></code> declaration which contains the paths and settings to reach to our upload web service. Our web service file is called <strong>upload.php</strong> and can be found in <strong>webservices/services/</strong> folder. The url to our web server location is <strong>http://localhost/multiplefileupload/</strong>.</p>
<ul class="ul">
<li>endpoint: this must point to <strong>gateway.php</strong>; in our case the url is <strong>http://localhost/multiplefileupload/webservices/gateway.php</strong></li>
<li>source: this is the filename of the PHP file containing the web service without the &#8220;.php&#8221; extension; in our case is <strong>upload</strong></li>
<li>destination: is the method from the file and class defined in source; in our case <strong>uploadFiles</strong></li>
</ul>
<p>These three are the attributes to reach the web service. Of course we set up the <strong>result</strong> and <strong>fault</strong> event handlers, the <strong>id</strong> and the <strong>showBusyCursor</strong> to true to visually show that the application is working.</p>
<p>Now we will define four states that will display different components depending of the state we are in.</p>
<ol>
<li><strong>initUpload</strong>: the first state that will be displayed at starting
<p><img src="http://www.flexer.info/wp-content/uploads/2009/09/figure2.png" alt="MultipleFileUploadUsingAMFPHP Flex Project" title="MultipleFileUploadUsingAMFPHP Flex Project" width="533" height="136" /></li>
<li><strong>beforeUploading</strong>: this will show the list with the files chosen and some buttons
<p><img src="http://www.flexer.info/wp-content/uploads/2009/09/figure3.png" alt="MultipleFileUploadUsingAMFPHP Flex Project" title="MultipleFileUploadUsingAMFPHP Flex Project" width="533" height="348" /></li>
<li><strong>inUploadProcess</strong>: this will show the progress and will have a button for canceling the process
<p><img src="http://www.flexer.info/wp-content/uploads/2009/09/figure4.png" alt="MultipleFileUploadUsingAMFPHP Flex Project" title="MultipleFileUploadUsingAMFPHP Flex Project" width="533" height="348" /></li>
<li><strong>uploadFinalized</strong>: this will show all the files and the finalized button
<p><img src="http://www.flexer.info/wp-content/uploads/2009/09/figure5.png" alt="MultipleFileUploadUsingAMFPHP Flex Project" title="MultipleFileUploadUsingAMFPHP Flex Project" width="533" height="348" /></li>
</ol>
<p>Next we will have a panel that will contain a Spark list and a few buttons that will appear according to the state we are in. I will not stop explaining about the new features of Flex 4 SDK and Flash Builder 4 because that is over our scope for now.</p>
<h2>A bit of theory &#8211; how the upload process work</h2>
<p>Now I want to explain how the upload process will work. The whole process is based on a stack idea. Files are uploaded one at a time. After the current file is uploaded or it has failed the next one will take its place and will be processed. </p>
<p>All files that have been chosen for upload are stored in a <strong>FileReferenceList</strong> object (<code>_refAddFiles</code>). We will iterate through it and we will add each <strong>FileReference</strong> object to <code>_arrUploadFiles</code> array collection. This array collection is used to display the files in a list and iterate through it to process each file reference object.</p>
<p>The process is started calling <code>startUpload()</code> method. These are the steps taken for each file reference object from <code>_arrUploadFiles</code> array collection:</p>
<ol>
<li>We add a complete event to current file reference<br />&nbsp;

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_arrUploadFiles<span style="color: #66cc66;">&#91;</span>_numCurrentUpload<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>
    Event.<span style="color: #006600;">COMPLETE</span>, handleFileLoadedComplete
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</li>
<li>We instruct it to load the file in the application memory <br />&nbsp;

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_arrUploadFiles<span style="color: #66cc66;">&#91;</span>_numCurrentUpload<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</li>
<li>When the file is loaded into the memory <code>handleFileLoadedComplete</code> is triggered</li>
<li>After the file is loaded into the memory we can read the content of the file<br />&nbsp;

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> tmpFileContent:<span style="color: #0066CC;">String</span> = 
    fileRef.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUTFBytes</span><span style="color: #66cc66;">&#40;</span>fileRef.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</li>
<li>We call the upload web service<br />&nbsp;

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">myUploadService.<span style="color: #006600;">uploadFiles</span><span style="color: #66cc66;">&#40;</span>
    <span style="color: #66cc66;">&#123;</span>filedata:tmpFileContent, filename:fileRef.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</li>
<li>The upload web service which is defined at the beginning with the <code><mx:RemoteObject></code> tag will trigger one of its event handlers:
<ul class="ul">
<li>result event if it is a success &#8211; <code>myUploadService_resultHandler</code></li>
<li>fault event if it is a failure &#8211; <code>myUploadService_faultHandler</code></li>
</ul>
</li>
<li>Result event will show in the list if the upload was successful with a green dot and the fault event will show that it has been an error and a failure with a red dot</li>
<li>The current file number is incremented and the process is started again with <code>startUpload()</code> method</li>
</ol>
<p>These are the steps taken for each file contained in a file reference object from _arrUploadFiles array collection.</p>
<p>You should notice that you need to use <code>readUTFBytes</code> method to get the content of the file and send them through the web service. Also you will be able to read the data of a file reference (<code>fileRef.data</code>) only after the files is loaded. This means that <code>load()</code> method must be called and the when the load is complete a complete event is triggered. After this the <code>fileRef.data</code> is available.</p>
<p>The main application code listing can be seen in the source archive. I will not put the whole code here because has lots of lines.</p>
<h2>About the custom list item renderer</h2>
<p>In order to display a feedback icon for each file we have to create a custom item renderer for our Spark list control. We tell the list that we are using a custom item renderer by specifying the item renderer attribute like bellow:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">itemRenderer=<span style="color: #ff0000;">&quot;com.flexer.CustomListItemRenderer&quot;</span></pre></div></div>

<p>We won’t go deep into the inner things of the custom component only just to specify that the icon is added at the end like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>s:BitmapImage id=<span style="color: #ff0000;">&quot;icon&quot;</span>
        source=<span style="color: #ff0000;">&quot;{data.ico}&quot;</span>
        verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span>
        <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></div></div>

<p>The image is taken from data object which is present in each item of the list, and is horizontally aligned at 3 pixels from right. You can see the whole component code bellow.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>s:ItemRenderer <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;CustomListItemRenderer&quot;</span>
    xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
    xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
    <span style="color: #0066CC;">focusEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
    <span style="color: #66cc66;">&lt;</span>s:states<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;normal&quot;</span> <span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;hovered&quot;</span> <span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;selected&quot;</span> <span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;normalAndShowsCaret&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;hoveredAndShowsCaret&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;selectedAndShowsCaret&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>s:states<span style="color: #66cc66;">&gt;</span>
&nbsp;
    <span style="color: #66cc66;">&lt;</span>fx:Script<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
            override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> labelText<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #0066CC;">super</span>.<span style="color: #006600;">labelText</span> = value;
                labelDisplay.<span style="color: #0066CC;">text</span> = labelText; 
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>fx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
    <span style="color: #66cc66;">&lt;</span>s:Rect <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:stroke.<span style="color: #006600;">normalAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>s:SolidColorStroke <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;{selectionColor}&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>s:stroke.<span style="color: #006600;">normalAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:stroke.<span style="color: #006600;">hoveredAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>s:SolidColorStroke <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;{selectionColor}&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>s:stroke.<span style="color: #006600;">hoveredAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:stroke.<span style="color: #006600;">selectedAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>s:SolidColorStroke <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;{selectionColor}&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>s:stroke.<span style="color: #006600;">selectedAndShowsCaret</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>s:fill<span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>s:SolidColor <span style="color: #0066CC;">color</span>.<span style="color: #006600;">normal</span>=<span style="color: #ff0000;">&quot;{contentBackgroundColor}&quot;</span>
                <span style="color: #0066CC;">color</span>.<span style="color: #006600;">normalAndShowsCaret</span>=<span style="color: #ff0000;">&quot;{contentBackgroundColor}&quot;</span>
                <span style="color: #0066CC;">color</span>.<span style="color: #006600;">hovered</span>=<span style="color: #ff0000;">&quot;{rollOverColor}&quot;</span>    
                <span style="color: #0066CC;">color</span>.<span style="color: #006600;">hoveredAndShowsCaret</span>=<span style="color: #ff0000;">&quot;{rollOverColor}&quot;</span>
                <span style="color: #0066CC;">color</span>.<span style="color: #006600;">selected</span>=<span style="color: #ff0000;">&quot;{selectionColor}&quot;</span>
                <span style="color: #0066CC;">color</span>.<span style="color: #006600;">selectedAndShowsCaret</span>=<span style="color: #ff0000;">&quot;{selectionColor}&quot;</span> <span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>s:fill<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>s:Rect<span style="color: #66cc66;">&gt;</span>
&nbsp;
    <span style="color: #66cc66;">&lt;</span>s:SimpleText id=<span style="color: #ff0000;">&quot;labelDisplay&quot;</span>
        verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span>
        <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;3&quot;</span> top=<span style="color: #ff0000;">&quot;6&quot;</span> bottom=<span style="color: #ff0000;">&quot;4&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;!</span>-- our mini dot icon showing the state of the file --<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>s:BitmapImage id=<span style="color: #ff0000;">&quot;icon&quot;</span>
        source=<span style="color: #ff0000;">&quot;{data.ico}&quot;</span>
        verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span>
        <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #66cc66;">/&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>s:ItemRenderer<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div>

<p>This icon is set from the main application where three dot icons are embedded.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;assets/bullet_empty.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _icoUploadNotStarted:<span style="color: #000000; font-weight: bold;">Class</span>;            
<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;assets/bullet_green.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _icoUploadSucces:<span style="color: #000000; font-weight: bold;">Class</span>;            
<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;assets/bullet_red.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _icoUploadFailed:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

<p><code>{data.ico}</code> contains the embedded icon.</p>
<h2>Conclusion</h2>
<p>AMF is a powerful data protocol and can be used for any kind of transfer. It has lots of advantages and is by far the most parsimonious protocol freely available. </p>
<p>Source files are available at the end of this article. Two zip archives and an fxp file exported from my Flash Builder 4 which contains also the php files (I used Flash Builder 4 with PDT and Zend Debugger).</p>
<h2>Resources</h2>
<p><a href="http://opensource.adobe.com/wiki/download/attachments/1114283/amf3_spec_05_05_08.pdf" target="_blank">http://opensource.adobe.com/wiki/download/attachments/1114283/amf3_spec_05_05_08.pdf</a><br />
<a href="http://www.amfphp.org/" target="_blank">http://www.amfphp.org/</a><br />
<a href="http://www.amfphp.org/docs2/index.html" target="_blank">http://www.amfphp.org/docs2/index.html</a><br />
<a href="http://framework.zend.com/manual/en/zend.amf.html" target="_blank">http://framework.zend.com/manual/en/zend.amf.html</a><br />
<a href="http://www.themidnightcoders.com/products/weborb-for-net/overview.html" target="_blank">http://www.themidnightcoders.com/products/weborb-for-net/overview.html</a><br />
<a href="http://www.themidnightcoders.com/products/weborb-for-rails/overview.html" target="_blank">http://www.themidnightcoders.com/products/weborb-for-rails/overview.html</a><br />
<a href="http://labs.adobe.com/technologies/flashbuilder4/" target="_blank">http://labs.adobe.com/technologies/flashbuilder4/</a><br />
<a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">http://en.wikipedia.org/wiki/Action_Message_Format</a><br />
<a href="http://www.zend.com/en/products/server-ce/" target="_blank">http://www.zend.com/en/products/server-ce/</a><br />
<a href="http://www.apachefriends.org/en/xampp.html" target="_blank">http://www.apachefriends.org/en/xampp.html</a><br />
<a href="http://www.wampserver.com/en/download.php" target="_blank">http://www.wampserver.com/en/download.php</a><br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=72483&#038;package_id=257933" target="_blank">http://sourceforge.net/project/showfiles.php?group_id=72483&#038;package_id=257933</a><br />
<a href="http://www.jamesward.com/census/" target="_blank">http://www.jamesward.com/census/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2009/09/02/multiple-file-upload-using-amfphp/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Flex For PHP Developers &#8211; A Must Read &#8220;Book Like&#8221; Article</title>
		<link>http://www.flexer.info/2009/08/19/flex-for-php-developers-a-must-read-book-like-article/</link>
		<comments>http://www.flexer.info/2009/08/19/flex-for-php-developers-a-must-read-book-like-article/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 12:09:27 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[Flex in the world]]></category>
		<category><![CDATA[Flex resources]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=1040</guid>
		<description><![CDATA[Mihai Corlan, Platform Evangelist at Adobe, finalized a &#8220;book like&#8221; article for PHP developers. I mentioned the &#8220;book like&#8221; words because the article is long, very long. 
The purpose of Mihai&#8217;s article is&#8230;
I want to share with you some of the things that are specific to Flex in relation to PHP. At the same time [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F08%2F19%2Fflex-for-php-developers-a-must-read-book-like-article%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F08%2F19%2Fflex-for-php-developers-a-must-read-book-like-article%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2009/08/19/flex-for-php-developers-a-must-read-book-like-article/&title=Flex+For+PHP+Developers+&#8211;+A+Must+Read+&#8220;Book+Like&#8221;+Article&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p><a href="http://corlan.org" target="_blank">Mihai Corlan</a>, Platform Evangelist at Adobe, finalized a <a href="http://corlan.org/flex-for-php-developers/" target="_blank">&#8220;book like&#8221; article for PHP developers</a>. I mentioned the &#8220;book like&#8221; words because the article is long, very long. </p>
<p>The purpose of Mihai&#8217;s article is&#8230;</p>
<blockquote><p>I want to share with you some of the things that are specific to Flex in relation to PHP. At the same time I want to introduce Flex by comparing it with PHP whenever this comparison makes sense.</p></blockquote>
<p>This is what it contains&#8230;</p>
<ol>
<li><a href="http://corlan.org/flex-for-php-developers/#a" target="_blank">What is Flex?</a>
<ol>
<li><a href="http://corlan.org/flex-for-php-developers/#a1" target="_blank">Flex: two languages, one framework to bind them</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#a2" target="_blank">Why you should care about Flex</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#a3" target="_blank">From thin client to smart/rich client</a></li>
</ol>
</li>
<li><a href="http://corlan.org/flex-for-php-developers/#b" target="_blank">Introduction to the MXML language</a>
<ol>
<li><a href="http://corlan.org/flex-for-php-developers/#b1" target="_blank">Mixing MXML with ActionScript 3</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#b2" target="_blank">CSS styles</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#b3" target="_blank">Modifying MXML code at runtime</a></li>
</ol>
</li>
<li><a href="http://corlan.org/flex-for-php-developers/#c" target="_blank">Introduction to the ActionScript 3 language</a>
<ol>
<li><a href="http://corlan.org/flex-for-php-developers/#c1" target="_blank">Separating statements</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c2" target="_blank">Data types, variables, constants</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c3" target="_blank">Functions and Anonymous functions (closures)</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c4" target="_blank">OOP: classes and interfaces</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c5" target="_blank">Variable scope</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c6" target="_blank">Arrays</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c7" target="_blank">Namespaces</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c8" target="_blank">Working with XML</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#c9" target="_blank">Dynamic ActionScript</a></li>
</ol>
</li>
<li><a href="http://corlan.org/flex-for-php-developers/#d" target="_blank">Flex is asynchronous</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#e" target="_blank">Data binding, metadata tags, and reflection</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#f" target="_blank">Where are my data, bring it on!</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#g" target="_blank">User authentication in Flex and PHP projects</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#h" target="_blank">Working on Flex and PHP projects</a>
<ol>
<li><a href="http://corlan.org/flex-for-php-developers/#h1" target="_blank">Flex SDK</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#h2" target="_blank">Flex Builder / Flash Builder</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#h3" target="_blank">Debugging Flex applications</a></li>
</ol>
</li>
<li><a href="http://corlan.org/flex-for-php-developers/#i" target="_blank">What is Adobe AIR?</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#j" target="_blank">What’s next?</a></li>
<li><a href="http://corlan.org/flex-for-php-developers/#k" target="_blank">Where to go from here</a></li>
</ol>
<p>We wish you good reading and patience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2009/08/19/flex-for-php-developers-a-must-read-book-like-article/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agenda for Flex 4 Tour &#8211; Bucharest Pit Stop</title>
		<link>http://www.flexer.info/2009/06/03/agenda-for-flex-4-tour-bucharest-pit-stop/</link>
		<comments>http://www.flexer.info/2009/06/03/agenda-for-flex-4-tour-bucharest-pit-stop/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 12:24:53 +0000</pubDate>
		<dc:creator>Stelian Crisan</dc:creator>
				<category><![CDATA[Conferences, Meetings & Events]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex 4 SDK]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[agenda]]></category>
		<category><![CDATA[bucharest]]></category>
		<category><![CDATA[Flex 4 Tour]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=859</guid>
		<description><![CDATA[As was expected we have at this time a final agenda for this event.
17:00 &#8211; 17:30
Registration participants
17:30 &#8211; 17:45
Opening Message
17:45 &#8211; 19:00
Flash Builder 4 &#038; Catalyst, Cornel Creanga &#038; Michael Corlan
19:00 &#8211; 19:45
Break for pizza and beer
19:45 &#8211; 20:15
Flex 4 SDK, Michael Pricop
20:15 &#8211; 20:45
PHP Services in Flash Builder 4, Andrei Ionescu
20:45 &#8211; 21:00
Break
21:15 &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents<!-- for Flex 4 Tour - Bucharest Pit Stop --></h3><ol><li><a href='http://www.flexer.info/2009/05/27/flex-4-tour-bucharest-pitstop/' title='Flex 4 Tour &#8211; Bucharest PitStop'>Flex 4 Tour &#8211; Bucharest PitStop</a></li><li><a href='http://www.flexer.info/2009/05/27/registration-for-adobe-user-group-tour-2009-flex-4-tour-bucharest-pit-stop-now-available/' title='Registration for Adobe User Group Tour 2009 &#8211; Flex 4 Tour &#8211; Bucharest Pit Stop Now Available'>Registration for Adobe User Group Tour 2009 &#8211; Flex 4 Tour &#8211; Bucharest Pit Stop Now Available</a></li><li>Agenda for Flex 4 Tour &#8211; Bucharest Pit Stop</li><li><a href='http://www.flexer.info/2009/06/11/bucharest-pit-stop-passed/' title='Bucharest Pit Stop Passed'>Bucharest Pit Stop Passed</a></li></ol></div> <div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F06%2F03%2Fagenda-for-flex-4-tour-bucharest-pit-stop%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2009%2F06%2F03%2Fagenda-for-flex-4-tour-bucharest-pit-stop%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2009/06/03/agenda-for-flex-4-tour-bucharest-pit-stop/&title=Agenda+for+Flex+4+Tour+&#8211;+Bucharest+Pit+Stop&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>As was expected we have at this time a final agenda for this event.</p>
<p>17:00 &#8211; 17:30<br />
<strong>Registration participants</strong><br />
17:30 &#8211; 17:45<br />
<strong>Opening Message</strong><br />
17:45 &#8211; 19:00<br />
<strong>Flash Builder 4 &#038; Catalyst</strong>, Cornel Creanga &#038; Michael Corlan<br />
19:00 &#8211; 19:45<br />
<strong>Break for pizza and beer</strong><br />
19:45 &#8211; 20:15<br />
<strong>Flex 4 SDK</strong>, Michael Pricop<br />
20:15 &#8211; 20:45<br />
<strong>PHP Services in Flash Builder 4</strong>, Andrei Ionescu<br />
20:45 &#8211; 21:00<br />
<strong>Break</strong><br />
21:15 &#8211; 21:45<br />
<strong>Skinning in Fx4</strong> &#8211; Stelian Crisan<br />
21:45 &#8211; 22:00<br />
<strong>Closing Message</strong></p>
<p>See you there in one week <img src='http://www.flexer.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
 <div class='series_links'><a href='http://www.flexer.info/2009/05/27/registration-for-adobe-user-group-tour-2009-flex-4-tour-bucharest-pit-stop-now-available/' title='Registration for Adobe User Group Tour 2009 &#8211; Flex 4 Tour &#8211; Bucharest Pit Stop Now Available'>Previous in series</a> <a href='http://www.flexer.info/2009/06/11/bucharest-pit-stop-passed/' title='Bucharest Pit Stop Passed'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2009/06/03/agenda-for-flex-4-tour-bucharest-pit-stop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Build a Download Application in Flex</title>
		<link>http://www.flexer.info/2008/05/12/how-to-build-a-download-application-in-flex/</link>
		<comments>http://www.flexer.info/2008/05/12/how-to-build-a-download-application-in-flex/#comments</comments>
		<pubDate>Mon, 12 May 2008 12:41:40 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[drag]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[FileReference]]></category>
		<category><![CDATA[HTTPService]]></category>
		<category><![CDATA[URLRequest]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=144</guid>
		<description><![CDATA[In this article I&#8217;ll show the same application I presented at FlexCamp Bucharest Romania 2008 &#8211; the video from the conference is available here and although it is in Romanian it might be useful. In the presentation I&#8217;m showing the power of Flex: doing complex applications with a few lines of codding. 
With this article [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F12%2Fhow-to-build-a-download-application-in-flex%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F12%2Fhow-to-build-a-download-application-in-flex%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/05/12/how-to-build-a-download-application-in-flex/&title=How+To+Build+a+Download+Application+in+Flex&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>In this article I&#8217;ll show the same application I presented at <a href="http://myadobe.ro/2008/04/11/flex-camp-aprilie-2008-agenda-a-fost-stabilita/" target="_blank">FlexCamp Bucharest Romania 2008</a> &#8211; the video from the conference is available <a href="http://my.adobe.acrobat.com/p90199006/" target="_blank">here</a> and although it is in Romanian it might be useful. In the presentation I&#8217;m showing the power of Flex: doing complex applications with a few lines of codding. </p>
<p>With this article we are just starting because everything is explained in the powerpoint presentation  and by the comments inside the source code found at the end of this article.</p>
<p>The application is simple &#8211; only one mxml file &#8211; and we will study:</p>
<ul class="ul">
<li>Multiple Drag and drop (<strong>events</strong>)</li>
<li><strong>HTTPService</strong></li>
<li><strong>FileReference</strong></li>
<li><strong>URLRequest</strong></li>
</ul>
<p>On the server-side:</p>
<ul class="ul">
<li><strong>dir.php</strong> &#8211; browsing (http service) – no parameters needed – returns a simple XML</li>
<li><strong>download.php</strong> &#8211; download (url request) – array with the paths that will be included in archive as parameters – returns an archive (tgz)</li>
<li><strong>archive.php</strong> &#8211; class to create arhives</li>
</ul>
<p>On the client-side:</p>
<ul class="ul">
<li>Tree &rArr; HTTPService &rArr; dir.php &rArr; HTTPService &rArr; Tree</li>
<li>Refresh &rArr; HTTPService &rArr; dir.php &rArr; HTTPService &rArr; Tree</li>
<li>Download &rArr; List &rArr; URLRequest &rArr; FileReference &rArr; file download</li>
</ul>
<p>We are using multiple selection and dragging so you can drag more that one item from the list. Also the delete key erases the selected items from the list on the right. You can start over by pressing refresh button.</p>
<p>This is the start of it and you can get into it more and more reading the powerpoints and trying the source codes. All this can be downloaded from the end of this article. </p>
<p>Working example is bellow:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_draganddrop_511164802"
			class="flashmovie"
			width="439"
			height="271">
	<param name="movie" value="/wp-content/uploads/2008/05/draganddrop.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2008/05/draganddrop.swf"
			name="fm_draganddrop_511164802"
			width="439"
			height="271">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
What can be added in the future:</p>
<ol>
<li>download progress with cancellation possibility</li>
<li>upload functionality</li>
<li>user account functionality</li>
</ol>
<p>The last two points are more difficult because it involves some work on the server-side but is doable.</p>
<p>I&#8217;ve posted also the whole flex source code because it is easier to follow the article and study the code in the same page.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> 
    <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;439&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;271&quot;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:HTTPService id=<span style="color: #ff0000;">&quot;dir&quot;</span> <span style="color: #0066CC;">url</span>=<span style="color: #ff0000;">&quot;{SERVER_URL}dir.php&quot;</span> resultFormat=<span style="color: #ff0000;">&quot;e4x&quot;</span> <span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:Tree id=<span style="color: #ff0000;">&quot;leftTree&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;250&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;204&quot;</span> 
        dataProvider=<span style="color: #ff0000;">&quot;{dir.lastResult}&quot;</span> labelField=<span style="color: #ff0000;">&quot;@name&quot;</span> showRoot=<span style="color: #ff0000;">&quot;false&quot;</span> 
        dragEnabled=<span style="color: #ff0000;">&quot;true&quot;</span> dropEnabled=<span style="color: #ff0000;">&quot;false&quot;</span> allowMultipleSelection=<span style="color: #ff0000;">&quot;true&quot;</span> 
        click=<span style="color: #ff0000;">&quot;showThumb(event)&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">List</span> id=<span style="color: #ff0000;">&quot;downloadList&quot;</span> x=<span style="color: #ff0000;">&quot;222&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;135&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;207&quot;</span> 
        allowMultipleSelection=<span style="color: #ff0000;">&quot;true&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{fileListProvider}&quot;</span> 
        dragEnter=<span style="color: #ff0000;">&quot;handleDragEnter(event)&quot;</span> dragOver=<span style="color: #ff0000;">&quot;handleDragOver(event)&quot;</span> 
        dragDrop=<span style="color: #ff0000;">&quot;handleDragDrop(event)&quot;</span> dragExit=<span style="color: #ff0000;">&quot;handleDragExit(event)&quot;</span> 
        click=<span style="color: #ff0000;">&quot;showThumb(event)&quot;</span> keyUp=<span style="color: #ff0000;">&quot;handleKeyUp(event)&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> id=<span style="color: #ff0000;">&quot;downloadButton&quot;</span> x=<span style="color: #ff0000;">&quot;347&quot;</span> y=<span style="color: #ff0000;">&quot;153&quot;</span> label=<span style="color: #ff0000;">&quot;Download&quot;</span> 
        <span style="color: #0066CC;">enabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> click=<span style="color: #ff0000;">&quot;initializeDownload(event)&quot;</span> <span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> id=<span style="color: #ff0000;">&quot;refreshButton&quot;</span> x=<span style="color: #ff0000;">&quot;347&quot;</span> y=<span style="color: #ff0000;">&quot;239&quot;</span> label=<span style="color: #ff0000;">&quot;Refresh&quot;</span> 
        click=<span style="color: #ff0000;">&quot;refresh(event)&quot;</span>  <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;82&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:Canvas id=<span style="color: #ff0000;">&quot;imageHolder&quot;</span> x=<span style="color: #ff0000;">&quot;222&quot;</span> y=<span style="color: #ff0000;">&quot;153&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;117&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;108&quot;</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>mx:Image id=<span style="color: #ff0000;">&quot;imageThumb&quot;</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;117&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;108&quot;</span> 
            source=<span style="color: #ff0000;">&quot;{currentPhotoPath}&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">messaging</span>.<span style="color: #006600;">channels</span>.<span style="color: #006600;">StreamingAMFChannel</span>;
            <span style="color: #808080; font-style: italic;">/* File downloading application
               Drag and drop between two different controlers: tree and list */</span>
&nbsp;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">ArrayCollection</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">listClasses</span>.<span style="color: #006600;">ListBase</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">UIComponent</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">managers</span>.<span style="color: #006600;">DragManager</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">DragSource</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #0066CC;">List</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">DragEvent</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// internet - on flexer</span>
            <span style="color: #0066CC;">public</span> const SERVER_URL:<span style="color: #0066CC;">String</span> = 
                <span style="color: #ff0000;">&quot;http://www.flexer.info/wp-content/uploads/2008/05/&quot;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// bindable variable used for the list</span>
            <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
            <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> fileListProvider:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// bindable variable used for thumbnail</span>
            <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
            <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> currentPhotoPath:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
&nbsp;
            <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> fRef:FileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* initialization function */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// file reference events - used for debug purposes</span>
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CANCEL</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">OPEN</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">SELECT</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>HTTPStatusEvent.<span style="color: #006600;">HTTP_STATUS</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ProgressEvent.<span style="color: #006600;">PROGRESS</span>, doEvent<span style="color: #66cc66;">&#41;</span>;
                fRef.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SecurityErrorEvent.<span style="color: #006600;">SECURITY_ERROR</span>, doEvent<span style="color: #66cc66;">&#41;</span>;				
&nbsp;
                <span style="color: #808080; font-style: italic;">// getting folder content</span>
                dir.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDragEnter<span style="color: #66cc66;">&#40;</span>event:DragEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function validates the drop */</span>
&nbsp;
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">dragInitiator</span> is Tree<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">var</span> ds:DragSource = event.<span style="color: #006600;">dragSource</span>;
                    <span style="color: #808080; font-style: italic;">// check if the format is what we need - treeItems</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>ds.<span style="color: #006600;">hasFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;treeItems&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> 
                        <span style="color: #b1b100;">return</span>;
                    <span style="color: #000000; font-weight: bold;">var</span> items:<span style="color: #0066CC;">Array</span> = ds.<span style="color: #006600;">dataForFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;treeItems&quot;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
                    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> items.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #000000; font-weight: bold;">var</span> item:<span style="color: #0066CC;">XML</span> = <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>items<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #808080; font-style: italic;">// we want only files to be dragable</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>item.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">type</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">&#41;</span> 
                            <span style="color: #b1b100;">return</span>; 
                    <span style="color: #66cc66;">&#125;</span>   
&nbsp;
                    <span style="color: #808080; font-style: italic;">// check for the item to be unique</span>
                    <span style="color: #000000; font-weight: bold;">var</span> paths:ArrayCollection = 
                        downloadList.<span style="color: #006600;">dataProvider</span> as ArrayCollection;
                    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>; j <span style="color: #66cc66;">&lt;</span> paths.<span style="color: #0066CC;">length</span>; j++<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>item.<span style="color: #66cc66;">@</span>path == paths<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">path</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span>;
                    <span style="color: #66cc66;">&#125;</span>
                <span style="color: #66cc66;">&#125;</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// accept the drop</span>
                DragManager.<span style="color: #006600;">acceptDragDrop</span><span style="color: #66cc66;">&#40;</span>UIComponent<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDragOver<span style="color: #66cc66;">&#40;</span>event:DragEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function shows feedback to the user */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// show feedback icon</span>
                DragManager.<span style="color: #006600;">showFeedback</span><span style="color: #66cc66;">&#40;</span>DragManager.<span style="color: #0066CC;">COPY</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDragDrop<span style="color: #66cc66;">&#40;</span>event:DragEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function adds new items to the list */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// getting source</span>
                <span style="color: #000000; font-weight: bold;">var</span> ds:DragSource = event.<span style="color: #006600;">dragSource</span>;
                <span style="color: #808080; font-style: italic;">// getting target</span>
                <span style="color: #000000; font-weight: bold;">var</span> dropTarget:<span style="color: #0066CC;">List</span> = <span style="color: #0066CC;">List</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// tempoaray array used to add items to list</span>
                <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span>;
&nbsp;
                <span style="color: #808080; font-style: italic;">// getting the nodes dragged </span>
                <span style="color: #808080; font-style: italic;">// multiple selection is allowed so we have arrays</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ds.<span style="color: #006600;">hasFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;items&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    arr = ds.<span style="color: #006600;">dataForFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;items&quot;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>ds.<span style="color: #006600;">hasFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;treeItems&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    arr = ds.<span style="color: #006600;">dataForFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;treeItems&quot;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
                <span style="color: #66cc66;">&#125;</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// adding the dragged nodes to list</span>
                <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> arr.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// getting node</span>
                    <span style="color: #000000; font-weight: bold;">var</span> node:<span style="color: #0066CC;">XML</span> = <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>arr<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #808080; font-style: italic;">// creating new list item</span>
                    <span style="color: #000000; font-weight: bold;">var</span> item:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #808080; font-style: italic;">// setting item's properties</span>
                    item.<span style="color: #006600;">label</span> = node.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">name</span>;
                    <span style="color: #808080; font-style: italic;">// we set path also which is needed for download</span>
                    item.<span style="color: #006600;">path</span> = node.<span style="color: #66cc66;">@</span>path;
                    <span style="color: #808080; font-style: italic;">// add to data provider</span>
                    fileListProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>item<span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
                <span style="color: #808080; font-style: italic;">// finish drag</span>
                handleDragExit<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>			
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDragExit<span style="color: #66cc66;">&#40;</span>event:DragEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function finishes the drag and drop */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// we hide the feedback</span>
                <span style="color: #000000; font-weight: bold;">var</span> dropTarget:ListBase=ListBase<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span><span style="color: #66cc66;">&#41;</span>;
                dropTarget.<span style="color: #006600;">hideDropFeedback</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// we check the data provider to enable the download button</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dropTarget.<span style="color: #006600;">dataProvider</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
                    downloadButton.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">true</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> showThumb<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function shows the thumbnail 
                   used for both tree and list click events */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// if click is on the tree</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span>.<span style="color: #0066CC;">name</span> == <span style="color: #ff0000;">&quot;leftTree&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// folders cannot show thumbnail</span>
                    <span style="color: #808080; font-style: italic;">// other file types than images are automatically not shown </span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>leftTree.<span style="color: #006600;">selectedItem</span>.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">type</span> == <span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">&#41;</span>
                        currentPhotoPath = SERVER_URL + leftTree.<span style="color: #006600;">selectedItem</span>.<span style="color: #66cc66;">@</span>path;
                    <span style="color: #b1b100;">else</span>
                        currentPhotoPath = <span style="color: #ff0000;">&quot;&quot;</span>;
                <span style="color: #808080; font-style: italic;">// if click is on the list</span>
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">currentTarget</span>.<span style="color: #0066CC;">name</span> == <span style="color: #ff0000;">&quot;downloadList&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    currentPhotoPath = <span style="color: #66cc66;">&#40;</span>downloadList.<span style="color: #006600;">selectedItem</span> ? SERVER_URL + 
                                        downloadList.<span style="color: #006600;">selectedItem</span>.<span style="color: #006600;">path</span> : <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleKeyUp<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function is used for deleting items from the list */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// if we have pressed the DELETE key and </span>
                <span style="color: #808080; font-style: italic;">// also there is at least one item selected</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">DELETE</span> <span style="color: #66cc66;">&amp;&amp;</span> 
                        downloadList.<span style="color: #006600;">selectedIndex</span> <span style="color: #66cc66;">&gt;</span> -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">var</span> removeItems:<span style="color: #0066CC;">Array</span> = downloadList.<span style="color: #006600;">selectedIndices</span>;
                    <span style="color: #808080; font-style: italic;">// remove selected items</span>
                    <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> removeItems.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        downloadList.<span style="color: #006600;">dataProvider</span>.<span style="color: #006600;">removeItemAt</span><span style="color: #66cc66;">&#40;</span>removeItems<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #66cc66;">&#125;</span>
                    currentPhotoPath = <span style="color: #ff0000;">&quot;&quot;</span>;
                    <span style="color: #808080; font-style: italic;">// if the list is empty we disable the download button</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>downloadList.<span style="color: #006600;">dataProvider</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&lt;</span>= <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
                        downloadButton.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">false</span>;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initializeDownload<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* this function starts the download 
                   we use FileReference to download */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// get the items dragged in the list</span>
                <span style="color: #000000; font-weight: bold;">var</span> paths:ArrayCollection = 
                    downloadList.<span style="color: #006600;">dataProvider</span> as ArrayCollection;
                <span style="color: #808080; font-style: italic;">// initialize the query/url string</span>
                <span style="color: #000000; font-weight: bold;">var</span> qStr:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
                <span style="color: #808080; font-style: italic;">// compose the query/url string</span>
                <span style="color: #808080; font-style: italic;">// we are sending an array to the server</span>
                <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> paths.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span>
                    qStr += <span style="color: #ff0000;">&quot;&amp;name[]=&quot;</span>+escape<span style="color: #66cc66;">&#40;</span>paths<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">path</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// get the file</span>
                <span style="color: #808080; font-style: italic;">// the file download.php on the server gets the array</span>
                <span style="color: #808080; font-style: italic;">// and in the memory creates an tgz archive</span>
                <span style="color: #808080; font-style: italic;">// and sends it back as being a file (using http headers)</span>
                <span style="color: #808080; font-style: italic;">// we are using FileReference for this</span>
                fRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span>
                    <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>SERVER_URL + <span style="color: #ff0000;">&quot;download.php?&quot;</span> + qStr<span style="color: #66cc66;">&#41;</span>,
                    <span style="color: #ff0000;">&quot;archive.tgz&quot;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> doEvent<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* Function is displaying events reached when downloading 
                   For debug purposes */</span>
&nbsp;
                <span style="color: #000000; font-weight: bold;">var</span> fr:FileReference = evt.<span style="color: #006600;">currentTarget</span> as FileReference;   
                <span style="color: #808080; font-style: italic;">// for debug purposes */</span>
                <span style="color: #808080; font-style: italic;">//trace(&quot;type:&quot;+evt.type+&quot;, eventString:&quot;+evt.toString()); </span>
                <span style="color: #808080; font-style: italic;">//trace(fr.creationDate);</span>
                <span style="color: #808080; font-style: italic;">//trace(fr.creator);</span>
                <span style="color: #808080; font-style: italic;">//trace(fr.modificationDate);</span>
                <span style="color: #808080; font-style: italic;">//trace(fr.name);</span>
                <span style="color: #808080; font-style: italic;">//trace(fr.size);</span>
                <span style="color: #808080; font-style: italic;">//trace(fr.type);</span>
            <span style="color: #66cc66;">&#125;</span> 		
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> refresh<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">/* Function is refresing both the tree and the list and 
                   disables the download button */</span>
&nbsp;
                <span style="color: #808080; font-style: italic;">// empty the list</span>
                fileListProvider = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// disable the download button</span>
                downloadButton.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">false</span>;
                <span style="color: #808080; font-style: italic;">// refresh the tree</span>
                dir.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div>

<p>This is it! As I just wrote at the beginning of the article, the power and beauty of Flex framework is that you can do great things with a few lines of codding. So enjoy Flex!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/05/12/how-to-build-a-download-application-in-flex/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using Shared Objects: Login Process with Remember Password</title>
		<link>http://www.flexer.info/2008/05/09/using-shared-objects-login-process-with-remember-password/</link>
		<comments>http://www.flexer.info/2008/05/09/using-shared-objects-login-process-with-remember-password/#comments</comments>
		<pubDate>Fri, 09 May 2008 14:38:41 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[sharedobject]]></category>

		<guid isPermaLink="false">http://www.flexer.info/?p=168</guid>
		<description><![CDATA[In this post we will implement a login process with remember password functionality. In AS3 and also in AS2 we can use a SharedObject to store data on the users browser. Shared objects are similar to the all known browser cookies but are managed by the flash player. Shared objects can store data also remotely [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F09%2Fusing-shared-objects-login-process-with-remember-password%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F05%2F09%2Fusing-shared-objects-login-process-with-remember-password%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/05/09/using-shared-objects-login-process-with-remember-password/&title=Using+Shared+Objects:+Login+Process+with+Remember+Password&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>In this post we will implement a login process with remember password functionality. In AS3 and also in AS2 we can use a <strong>SharedObject</strong> to store data on the users browser. Shared objects are similar to the all known browser cookies but are managed by the flash player. Shared objects can store data also remotely on the server and using this feature some complex communication models can be implemented. But we will focus on our login with remember password (see <a href="#app">here</a> the working application).</p>
<p>For this we need a server-side and I used PHP because my preferred server-side language is PHP. The server-side is very simple and contains one function that will check the user name and the password with some hard coded constants. Here is the code inside <strong>login.php</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// hard coded username and password</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;USER&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;flexer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PASS&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;fx{r}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// login function</span>
<span style="color: #000000; font-weight: bold;">function</span> login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$u</span><span style="color: #339933;">,</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// checking for valid username and password</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$u</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$u</span> <span style="color: #339933;">==</span> USER <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$p</span> <span style="color: #339933;">==</span> PASS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// login was successful</span>
        <span style="color: #000088;">$loginOk</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$loginErr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// login failed</span>
        <span style="color: #000088;">$loginOk</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$loginErr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Invalid user and/or password!&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// returning an XML with data</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&lt;login&gt;&lt;loginOk&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$loginOk</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/loginOk&gt;&lt;loginErr&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$loginErr</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/loginErr&gt;&lt;/login&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// we send the xml header</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// we print resutl to output</span>
<span style="color: #b1b100;">echo</span> login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What this server-side script file does can be easily understand from the comments so we will move forward to client-side.</p>
<p>For the remember password functionality we use a <strong>SharedObject</strong> which will be saved in the local machine. This file can be encoded (we didn&#8217;t encode it) and a location to save in can be specified. More about encoding <a href="http://livedocs.adobe.com/flex/2/langref/flash/net/SharedObject.html#objectEncoding" target="_blank">here</a> and about setting a location <a href="http://livedocs.adobe.com/flex/2/langref/flash/net/SharedObject.html#getLocal()" target="_blank">here</a>.</p>
<p>A <strong>SharedObject </strong>is called like this</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> _remeberSO:<span style="color: #0066CC;">SharedObject</span> = <span style="color: #0066CC;">SharedObject</span>.<span style="color: #0066CC;">getLocal</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;loginData&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p> and what it happens:</p>
<ul class="ul">
<li>if the shared object named <strong>&#8220;loginData&#8221;</strong> doesn&#8217;t exists a new one with empty <strong>data</strong> property is created </li>
<li>if the shared object named <strong>&#8220;loginData&#8221;</strong> exists the previously saved info is retrieved and the <strong>data</strong> property is filled in with that info</li>
</ul>
<p>The data property is set like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">username</span> = username.<span style="color: #0066CC;">text</span>;
_remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">password</span> = <span style="color: #0066CC;">password</span>.<span style="color: #0066CC;">text</span>;</pre></div></div>

<p> and is get in the same manner.</p>
<p>To save/write the object we use</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_remeberSO.<span style="color: #0066CC;">flush</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>To clear</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_remeberSO.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In this example we use also a <strong>ViewStack </strong>but to make everything more clear bellow you can study the whole flex code and I hope you&#8217;ll understand very well what is happening from the comments.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
    layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;253&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;307&quot;</span> 
    creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:HTTPService id=<span style="color: #ff0000;">&quot;doLoginService&quot;</span> method=<span style="color: #ff0000;">&quot;POST&quot;</span> 
        <span style="color: #0066CC;">url</span>=<span style="color: #ff0000;">&quot;http://www.flexer.info/wp-content/uploads/2008/05/login.php&quot;</span> 
        resultFormat=<span style="color: #ff0000;">&quot;e4x&quot;</span> result=<span style="color: #ff0000;">&quot;handleDoLoginResult(event)&quot;</span> 
        showBusyCursor=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">/&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:ViewStack x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;233&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;287&quot;</span> id=<span style="color: #ff0000;">&quot;myStack&quot;</span> 
        change=<span style="color: #ff0000;">&quot;handleStackChange(event)&quot;</span><span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>mx:Canvas id=<span style="color: #ff0000;">&quot;logIn&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;284&quot;</span><span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;77&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Username:&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;103&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Password:&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:TextInput x=<span style="color: #ff0000;">&quot;75&quot;</span> y=<span style="color: #ff0000;">&quot;75&quot;</span> id=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;158&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:TextInput x=<span style="color: #ff0000;">&quot;75&quot;</span> y=<span style="color: #ff0000;">&quot;101&quot;</span> id=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;158&quot;</span> 
                displayAsPassword=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:CheckBox x=<span style="color: #ff0000;">&quot;75&quot;</span> y=<span style="color: #ff0000;">&quot;131&quot;</span> label=<span style="color: #ff0000;">&quot;Remeber password&quot;</span> 
                id=<span style="color: #ff0000;">&quot;rememberStack1&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> x=<span style="color: #ff0000;">&quot;75&quot;</span> y=<span style="color: #ff0000;">&quot;157&quot;</span> label=<span style="color: #ff0000;">&quot;Login&quot;</span> 
                click=<span style="color: #ff0000;">&quot;handleDoLoginClick(event)&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;233&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;67&quot;</span><span style="color: #66cc66;">&gt;</span>
                <span style="color: #66cc66;">&lt;</span>mx:htmlText<span style="color: #66cc66;">&gt;</span>		
<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>Use the following login <span style="color: #0066CC;">data</span>.
&nbsp;
<span style="color: #006600;">Username</span>: <span style="color: #66cc66;">&lt;</span>b<span style="color: #66cc66;">&gt;</span>flexer<span style="color: #66cc66;">&lt;/</span>b<span style="color: #66cc66;">&gt;</span>
<span style="color: #0066CC;">Password</span>: <span style="color: #66cc66;">&lt;</span>b<span style="color: #66cc66;">&gt;</span>fx<span style="color: #66cc66;">&#123;</span>r<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&lt;/</span>b<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
                <span style="color: #66cc66;">&lt;/</span>mx:htmlText<span style="color: #66cc66;">&gt;</span>		
            <span style="color: #66cc66;">&lt;/</span>mx:Text<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;</span>mx:Canvas id=<span style="color: #ff0000;">&quot;loggedIn&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;285&quot;</span><span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;233&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;219&quot;</span><span style="color: #66cc66;">&gt;</span>
                <span style="color: #66cc66;">&lt;</span>mx:htmlText<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&lt;</span>b<span style="color: #66cc66;">&gt;</span>You are logged <span style="color: #b1b100;">in</span><span style="color: #66cc66;">!&lt;/</span>b<span style="color: #66cc66;">&gt;</span> You can <span style="color: #0066CC;">log</span> out 
<span style="color: #0066CC;">and</span> specify <span style="color: #b1b100;">if</span> you prefer to have the 
<span style="color: #0066CC;">password</span> remembered next <span style="color: #0066CC;">time</span>. 
&nbsp;
<span style="color: #006600;">To</span> see that the username <span style="color: #0066CC;">and</span> <span style="color: #0066CC;">password</span> 
are remembered please use the follwing
scenarios:
&nbsp;
<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> Refresh the whole browser page.
<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> Logout <span style="color: #0066CC;">and</span> the refresh the whole 
page. 						
<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> Uncheck <span style="color: #ff0000;">&quot;Remember password&quot;</span> <span style="color: #0066CC;">and</span>
refresh the page.
<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> Uncheck <span style="color: #ff0000;">&quot;Remember password&quot;</span>,
logout <span style="color: #0066CC;">and</span> refresh.<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
                <span style="color: #66cc66;">&lt;/</span>mx:htmlText<span style="color: #66cc66;">&gt;</span>
            <span style="color: #66cc66;">&lt;/</span>mx:Text<span style="color: #66cc66;">&gt;</span>			
            <span style="color: #66cc66;">&lt;</span>mx:CheckBox x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;227&quot;</span> label=<span style="color: #ff0000;">&quot;Remember password&quot;</span> 
                id=<span style="color: #ff0000;">&quot;rememberStack2&quot;</span><span style="color: #66cc66;">/&gt;</span>
            <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> x=<span style="color: #ff0000;">&quot;0&quot;</span> y=<span style="color: #ff0000;">&quot;253&quot;</span> label=<span style="color: #ff0000;">&quot;Logout&quot;</span> 
                click=<span style="color: #ff0000;">&quot;handleLogout(event)&quot;</span><span style="color: #66cc66;">/&gt;</span>
        <span style="color: #66cc66;">&lt;/</span>mx:Canvas<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>mx:ViewStack<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
        <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
            <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// our shared object that will save</span>
            <span style="color: #808080; font-style: italic;">// the username and password localy </span>
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _remeberSO:<span style="color: #0066CC;">SharedObject</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// initialization</span>
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">// getting data from shared object</span>
                <span style="color: #808080; font-style: italic;">// if the object named &quot;loginData&quot; and</span>
                <span style="color: #808080; font-style: italic;">// saved localy doesn't exists it is </span>
                <span style="color: #808080; font-style: italic;">// created without data</span>
                <span style="color: #808080; font-style: italic;">// if it exists the data is recovered and</span>
                <span style="color: #808080; font-style: italic;">// put inside &quot;data&quot; property</span>
                _remeberSO = <span style="color: #0066CC;">SharedObject</span>.<span style="color: #0066CC;">getLocal</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;loginData&quot;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #808080; font-style: italic;">// if we have username and password saved</span>
                <span style="color: #808080; font-style: italic;">// we do auto-login</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">username</span> <span style="color: #66cc66;">!</span>= <span style="color: #0066CC;">undefined</span> <span style="color: #66cc66;">&amp;&amp;</span> 
                    _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">password</span> <span style="color: #66cc66;">!</span>= <span style="color: #0066CC;">undefined</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#123;</span>
                    rememberStack1.<span style="color: #006600;">selected</span> = <span style="color: #000000; font-weight: bold;">true</span>;
                    username.<span style="color: #0066CC;">text</span> = _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">username</span>;
                    <span style="color: #0066CC;">password</span>.<span style="color: #0066CC;">text</span> = _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">password</span>;
                    <span style="color: #808080; font-style: italic;">// calling the login service to check </span>
                    <span style="color: #808080; font-style: italic;">// the username and password</span>
                    doLoginService.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>_remeberSO.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// called when the &quot;Login&quot; button is clicked</span>
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDoLoginClick<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">var</span> sendData:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span> username:username.<span style="color: #0066CC;">text</span>,
                                        <span style="color: #0066CC;">password</span>:<span style="color: #0066CC;">password</span>.<span style="color: #0066CC;">text</span> <span style="color: #66cc66;">&#125;</span>;
                <span style="color: #808080; font-style: italic;">// calling the login service</span>
                doLoginService.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>sendData<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// called by the &quot;HTTP Service&quot; when successful</span>
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleDoLoginResult<span style="color: #66cc66;">&#40;</span>event:ResultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">// get the status of login process</span>
                <span style="color: #808080; font-style: italic;">// loginOk = 0 - means invalid username/password</span>
                <span style="color: #808080; font-style: italic;">// loginOk = 1 - means login successful</span>
                <span style="color: #808080; font-style: italic;">// loginErr = &quot;&quot; - when loginOk = 1</span>
                <span style="color: #808080; font-style: italic;">// loginErr = &quot;error&quot; - when loginOk = 0</span>
                <span style="color: #000000; font-weight: bold;">var</span> loginOk:uint = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">result</span>.<span style="color: #006600;">loginOk</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #000000; font-weight: bold;">var</span> loginErr:<span style="color: #0066CC;">String</span> = event.<span style="color: #006600;">result</span>.<span style="color: #006600;">loginErr</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>loginOk<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// if the login failed we alert</span>
                    Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>loginErr<span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rememberStack1.<span style="color: #006600;">selected</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #808080; font-style: italic;">// if we selected remember password</span>
                        <span style="color: #808080; font-style: italic;">// we save the login data in the shared object</span>
                        _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">username</span> = username.<span style="color: #0066CC;">text</span>;
                        _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">password</span> = <span style="color: #0066CC;">password</span>.<span style="color: #0066CC;">text</span>;
                        <span style="color: #808080; font-style: italic;">// saving/writing</span>
                        _remeberSO.<span style="color: #0066CC;">flush</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #808080; font-style: italic;">// otherwise we clear the shared object</span>
                        _remeberSO.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                    <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #808080; font-style: italic;">// move to next stack</span>
                    myStack.<span style="color: #006600;">selectedIndex</span>++;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// called when the &quot;Logout&quot; button is clicked</span>
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleLogout<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>rememberStack2.<span style="color: #006600;">selected</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// if have NOT selected remember password</span>
                    <span style="color: #808080; font-style: italic;">// we clear the shared object</span>
                    _remeberSO.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// if we selected remember password</span>
                    <span style="color: #808080; font-style: italic;">// we save data as we may login </span>
                    <span style="color: #808080; font-style: italic;">// without checking the checkbox in the</span>
                    <span style="color: #808080; font-style: italic;">// first screen but we want to select it</span>
                    <span style="color: #808080; font-style: italic;">// after login</span>
                    _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">username</span> = username.<span style="color: #0066CC;">text</span>;
                    _remeberSO.<span style="color: #0066CC;">data</span>.<span style="color: #0066CC;">password</span> = <span style="color: #0066CC;">password</span>.<span style="color: #0066CC;">text</span>;
                    <span style="color: #808080; font-style: italic;">// saving/writing</span>
                    _remeberSO.<span style="color: #0066CC;">flush</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #66cc66;">&#125;</span>
                myStack.<span style="color: #006600;">selectedIndex</span>--;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleStackChange<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #808080; font-style: italic;">// we are sychronizing the two checkboxes</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>myStack.<span style="color: #006600;">selectedChild</span> == logIn<span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// we got back to first screen - login</span>
                    rememberStack1.<span style="color: #006600;">selected</span> = rememberStack2.<span style="color: #006600;">selected</span>;
                <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #808080; font-style: italic;">// we got to the second screen</span>
                    rememberStack2.<span style="color: #006600;">selected</span> = rememberStack1.<span style="color: #006600;">selected</span>;
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p><a name="app"></a>The working application is bellow and you can try the following scenarios to test the login process:</p>
<ol>
<li>Refresh the whole browser page</li>
<li>Logout and the refresh the whole page</li>
<li>Uncheck &#8220;Remember password&#8221; and refresh the page</li>
<li>Uncheck &#8220;Remember password&#8221;, logout and refresh</li>
</ol>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_shareobjectapplication_1318755082"
			class="flashmovie"
			width="253"
			height="307">
	<param name="movie" value="/wp-content/uploads/2008/05/shareobjectapplication.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/wp-content/uploads/2008/05/shareobjectapplication.swf"
			name="fm_shareobjectapplication_1318755082"
			width="253"
			height="307">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Hope you got the whole idea and now you can use shared object as you like in you projects.</p>
<p><a href="http://livedocs.adobe.com/flex/2/langref/flash/net/SharedObject.html" target="_blank">Here</a> is the documentation about shared objects very nice and clean (by Adobe, on Livedocs).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/05/09/using-shared-objects-login-process-with-remember-password/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Flex and PHP web-service</title>
		<link>http://www.flexer.info/2008/02/17/flex-and-php-web-service/</link>
		<comments>http://www.flexer.info/2008/02/17/flex-and-php-web-service/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 08:52:36 +0000</pubDate>
		<dc:creator>Virgil Cristea</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex 2]]></category>
		<category><![CDATA[Flex resources]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.flexer.info/2008/02/17/flex-and-php-web-service/</guid>
		<description><![CDATA[Yesterday I had to do a small flex application that resided on a server with php. Since I required a connection to mysql I wanted to use the same class I did before to connect to web-services. But PHP does not support web-services (and WSDL) by default.
So after I did some search on the net [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents<!-- for Web Services - HowTo --></h3><ol><li><a href='http://www.flexer.info/2007/10/23/web-service-small-how-to/' title='Web Service small how-to'>Web Service small how-to</a></li><li>Flex and PHP web-service</li></ol></div> <div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F17%2Fflex-and-php-web-service%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2008%2F02%2F17%2Fflex-and-php-web-service%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2008/02/17/flex-and-php-web-service/&title=Flex+and+PHP+web-service&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Yesterday I had to do a small flex application that resided on a server with php. Since I required a connection to mysql I wanted to use the same class I did before to connect to web-services. But PHP does not support web-services (and WSDL) by default.</p>
<p>So after I did some search on the net I found this nice php class: NuSOAP. Here it is the small php webservice I did to test it all (file test.php):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Pull in the NuSOAP code</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'nusoap.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define namespace to use</span>
<span style="color: #000088;">$ns</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://localhost/wsdlphp&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Create the server instance</span>
<span style="color: #000088;">$server</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> soap_server<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Configure WDSL response</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configureWSDL</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hello'</span><span style="color: #339933;">,</span><span style="color: #000088;">$ns</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Set default namespace for output</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">wsdl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">schemaTargetNamespace</span><span style="color: #339933;">=</span><span style="color: #000088;">$ns</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Register the method to expose</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hello'</span><span style="color: #339933;">,</span>
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'return'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #000088;">$ns</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define the method as a PHP function</span>
<span style="color: #000000; font-weight: bold;">function</span> hello<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'Hello, '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Use the request to (try to) invoke the service</span>
<span style="color: #000088;">$HTTP_RAW_POST_DATA</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$HTTP_RAW_POST_DATA</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$HTTP_RAW_POST_DATA</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">service</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$HTTP_RAW_POST_DATA</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you see here there is one service called test.php and one webmethod called hello. This method has one parameter as input (name):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hello'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'return'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ns</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here is the flex code to connect and use the webmethod:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>mx:application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #66cc66;">&gt;</span>
	applicationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">soap</span>.<span style="color: #006600;">Operation</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">InvokeEvent</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">soap</span>.<span style="color: #006600;">LoadEvent</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">FaultEvent</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;
			<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">soap</span>.<span style="color: #006600;">WebService</span>;
			<span style="color: #0066CC;">import</span> ro.<span style="color: #006600;">qbic</span>.<span style="color: #006600;">testmessage</span>;		
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _service : WebService;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _currentMessage: testmessage;
&nbsp;
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				_currentMessage = <span style="color: #000000; font-weight: bold;">new</span> testmessage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;a&quot;</span><span style="color: #66cc66;">&#41;</span>;
				_service = <span style="color: #000000; font-weight: bold;">new</span> WebService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				_service.<span style="color: #006600;">wsdl</span> = <span style="color: #ff0000;">&quot;http://localhost/WSDLPHP/test.php?wsdl&quot;</span>;
				_service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ResultEvent.<span style="color: #006600;">RESULT</span>, handleResult, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
				_service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>FaultEvent.<span style="color: #006600;">FAULT</span>, handleFault, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
				_service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>LoadEvent.<span style="color: #0066CC;">LOAD</span>, handleLoad, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
				_service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>InvokeEvent.<span style="color: #006600;">INVOKE</span>, handleInvoke, <span style="color: #000000; font-weight: bold;">false</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
				_service.<span style="color: #006600;">loadWSDL</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleResult<span style="color: #66cc66;">&#40;</span>event:ResultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">// Get data from RESULT node</span>
				<span style="color: #000000; font-weight: bold;">var</span> tmpResp:<span style="color: #0066CC;">XML</span> = event.<span style="color: #006600;">result</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleFault<span style="color: #66cc66;">&#40;</span>event:FaultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> errorMessage:<span style="color: #0066CC;">String</span> =  event.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultString</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + event.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultDetail</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleLoad<span style="color: #66cc66;">&#40;</span>event:LoadEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				_service.<span style="color: #006600;">getOperation</span><span style="color: #66cc66;">&#40;</span>_currentMessage.<span style="color: #006600;">webMethod</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">arguments</span> = _currentMessage;
				<span style="color: #66cc66;">&#40;</span>_service.<span style="color: #006600;">getOperation</span><span style="color: #66cc66;">&#40;</span>_currentMessage.<span style="color: #006600;">webMethod</span><span style="color: #66cc66;">&#41;</span> as Operation<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">resultFormat</span> = <span style="color: #ff0000;">&quot;e4x&quot;</span>;
				_service.<span style="color: #006600;">getOperation</span><span style="color: #66cc66;">&#40;</span>_currentMessage.<span style="color: #006600;">webMethod</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleInvoke<span style="color: #66cc66;">&#40;</span>event:InvokeEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:script<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:application<span style="color: #66cc66;">&gt;</span></pre></div></div>

 <div class='series_links'><a href='http://www.flexer.info/2007/10/23/web-service-small-how-to/' title='Web Service small how-to'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2008/02/17/flex-and-php-web-service/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex and PHP &#8211; Party in the Front, Business in the Back</title>
		<link>http://www.flexer.info/2007/11/19/flex-and-php-party-in-the-front-business-in-the-back/</link>
		<comments>http://www.flexer.info/2007/11/19/flex-and-php-party-in-the-front-business-in-the-back/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 10:24:37 +0000</pubDate>
		<dc:creator>Andrei Ionescu</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex in the world]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[client-side]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[server-side]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.flexer.info/2007/11/19/flex-and-php-party-in-the-front-business-in-the-back/</guid>
		<description><![CDATA[Last days I found a very interesting and easy learning article about how Flex application can interact with PHP on the server-side. The article shows how this two technologies can work together. On the server-side Zend Framework, a MVC platform, which I used a lot is used to structure the application and to be able [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.flexer.info%2F2007%2F11%2F19%2Fflex-and-php-party-in-the-front-business-in-the-back%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.flexer.info%2F2007%2F11%2F19%2Fflex-and-php-party-in-the-front-business-in-the-back%2F" height="61" width="51" /></a></div><div style="float: right; margin-right: 10px"><a class="google_buzz"  
href="http://www.google.com/reader/link?url=http://www.flexer.info/2007/11/19/flex-and-php-party-in-the-front-business-in-the-back/&title=Flex+and+PHP+&#8211;+Party+in+the+Front,+Business+in+the+Back&srcURL=http://www.flexer.info" target="_blank" rel="nofollow"><img
src="http://www.flexer.info/wp-content/plugins/google-buzz-button-for-wordpress/images/google-buzz.png" alt="Google Buzz" /></a></div><p>Last days I found a very interesting and easy learning article about how Flex application can interact with PHP on the server-side. The article shows how this two technologies can work together. On the server-side <a href="http://framework.zend.com/">Zend Framework</a>, a MVC platform, which I used a lot is used to structure the application and to be able to have all kinds of client-sides (HTML, AJAX, Flash, Flex, etc).</p>
<p>The article is <a href="http://dougmccune.com/flex/zomgzrss/" target="_blank">here</a> and all source codes are <a href="http://devzone.zend.com/content/mashuptimes.zip" target="_blank">here</a>.</p>
<p>Zend Framework cand be dowloaded <a href="http://framework.zend.com/">here</a>.</p>
<p>Enjoy studying it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexer.info/2007/11/19/flex-and-php-party-in-the-front-business-in-the-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

