<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2009://34.36109-</id>
  <updated>2009-11-16T14:57:18Z</updated>
  <title>Comments for Enhanced status component (http://www.insideria.com/2009/06/enhanced-status-component.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2009://34.36109</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=36109" title="Enhanced status component" />
    <published>2009-06-02T13:00:00Z</published>
    <updated>2009-06-02T13:49:42Z</updated>
    <title>Enhanced status component</title>
    <summary>In the last article we worked extensively with the ProfilePic component and showed how the component can be used in real time scenarios. We had an interesting example of a real word application with the &quot;Would you...&quot; application clone. I really had a lot of fun working on it and hope you too. For us it&apos;s important that we were able to work with components that where previously build based on the previous articles. The goal is not to hurt the &quot;DRY&#8220; principle, which means &quot;Don&apos;t repeat your self&quot;. Every component that was created needs to reused again so no development time will be spent on them anymore, except when extending it. This tutorial will deal mostly with text. The idea of the application is the following: We need to create some sort of &quot;Mood Checker&quot;, an application that will allow us to browse through the statuses of users. </summary>
    <author>
      <name>Mirza Hatipovic</name>
      
    </author>
    
    <category term="Adobe Feed" />
    
    <category term="Features" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[<div style="text-align: left;">In the <a href="http://www.insideria.com/2009/05/extended-profilepic-component.html" target="_blank">last article</a> we worked extensively with the ProfilePic component and showed how the component can be used in real time scenarios. We had an interesting example of a real word application with the "Would you..." application clone. I really had a lot of fun working on it and hope you did too. For us, it's important that we were able to work with components that were previously built based on the previous articles. The goal is to not go against the "DRY&#8220; principle. Every component that was created needs to be reused again, so no development time will be spent on them anymore, except when extending it. This tutorial will deal mostly with text. The idea of the application is the following: We need to create some sort of "Mood Checker", an application that will allow us to browse through the statuses of users. </div>

<div class="ap_r"><a href="http://www.insideria.com/series-facebook-dev.html"><img src="http://www.insideria.com/upload/2009/04/fb_app_9.jpg" alt="series badge" style="width: 148px;" /></a><div class="apcaption">Find the rest of this series on the <a href="http://www.insideria.com/series-facebook-dev.html">series page</a>.</div></div>

<div style="text-align: left;">Here is the final image of the application:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img17.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img17.html','popup','width=598,height=381,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img17-thumb-400x254.png" width="400" height="254" alt="article9_img17.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">So, all statuses will be loaded and stored and the user will be able to browse through the statuses. For example I have basketball on my mind and I need one of my friends to go play basketball. I will type in keywords like "basketball, sports" and the application will filter statuses and display friends with similar activities on their mind. It's a great way collect friends for any sort of event. Also, it can be used to find out how somebody is feeling, like for example you can type in "happy" and the application will display friends that are feeling this way.</div>

<div style="text-align: left;">In order for this application to work, we need the status component from <a href="http://www.insideria.com/2009/05/components-architecture-for-fa.html" target="_blank">part 6</a> of the series where we created a very simple status bar with no formatting at all. This time we need enhance the component a bit to format the text inside of it. While creating this application, we will discover that there are endless possibilities and ways to extend it and this article will be able to cover only one part of those ideas.</div>

<div style="text-align: left;">Let's define the logic flow of the application.</div>

<ul>
	<li>the application loads in the Facebook canvas</li>
	<li>the application loads the statuses of every friend we have in our list</li>
	<li>user types in a key word into the search text field</li>
	<li>the application searches for the keyword in the list of statuses</li>
	<li>the application displays a list of friends with keywords in the status</li>
</ul>

<div style="text-align: left;">Let's start with the actual application.</div>

<div style="text-align: left;">Open the fla we worked on previously. </div>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_ima1.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_ima1.html','popup','width=412,height=344,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_ima1-thumb-400x333.png" width="400" height="333" alt="article9_ima1.png" class="mt-image-none" style="" /></a></span>

<div style="text-align: left;">Remove all code that was on the first frame and leave the two layer structure of frames.</div> 

<div style="text-align: left;">All we need to remember here is the api key and the secret provided by Facebook for our application. </div>

<div style="text-align: left;">Next thing we need to do is to create a valid Facebook session with the following code:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoData;
<span class="category1">import</span> com.facebook.utils.FacebookSessionUtil;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.FacebookUser;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoFieldValues;
<span class="category1">import</span> com.facebook.commands.users.GetInfo;
<span class="category1">import</span> com.facebook.commands.friends.*;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.friends.*;
<span class="category1">import</span> com.facebook.net.FacebookCall;
<span class="category1">import</span> com.facebook.events.FacebookEvent;
<span class="category1">import</span> com.facebook.Facebook;

<span class="category1">var</span> fbook:Facebook;
<span class="category1">var</span> session:FacebookSessionUtil;
<span class="category1">var</span> user:FacebookUser;</pre>
</code>

</div></div> 

<div style="text-align: left;">And then we can start the Facebook session:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

session = <span class="category1">new</span> FacebookSessionUtil("<span class="quote">YOUR_API_KEY</span>", "<span class="quote">YOUR_SECRET</span>", loaderInfo);
fbook = session.facebook;</pre>
</code>

</div></div> 

<div style="text-align: left;">The next thing we need to do is to get the code from <a href="http://www.insideria.com/2009/05/components-architecture-for-fa.html" target="_blank">article six</a> and reload the UserStatus component. If you followed the <a href="http://www.insideria.com/series-facebook-dev.html" target="_blank">previous tutorials</a>, the UserStatus component should be in your library. </div>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img2.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img2.html','popup','width=319,height=171,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img2-thumb-319x171.png" width="319" height="171" alt="article9_img2.png" class="mt-image-none" style="" /></a></span>

<div style="text-align: left;">Let's see if our component is still working (it should work :-) ). In the first step we created a valid Facebook session code: </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoData;
<span class="category1">import</span> com.facebook.utils.FacebookSessionUtil;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.FacebookUser;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoFieldValues;
<span class="category1">import</span> com.facebook.commands.users.GetInfo;
<span class="category1">import</span> com.facebook.commands.friends.*;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.friends.*;
<span class="category1">import</span> com.facebook.net.FacebookCall;
<span class="category1">import</span> com.facebook.events.FacebookEvent;
<span class="category1">import</span> com.facebook.Facebook;

<span class="category1">var</span> fbook:Facebook;
<span class="category1">var</span> session:FacebookSessionUtil;
<span class="category1">var</span> user:FacebookUser;

session = <span class="category1">new</span> FacebookSessionUtil("<span class="quote">YOUR_API_KEY</span>", "<span class="quote">YOUR_SECRET</span>", loaderInfo);
fbook = session.facebook;</pre>
</code>

</div></div> 

<div style="text-align: left;">Now, let's place the UserStatus component on the stage. Drag one instance from the library to the stage:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img3.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img3.html','popup','width=371,height=301,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img3-thumb-371x301.png" width="371" height="301" alt="article9_img3.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Give it an instance name status1_mc. Finally in the code, place the line of code:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

status1_mc.loadStatus(fbook);</pre>
</code>

</div></div>

<div style="text-align: left;">The line of code is self explanatory. OK, here is what we got when the swf is compiled, uploaded and loaded in the fb canvas:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img4.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img4.html','popup','width=401,height=153,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img4-thumb-401x153.png" width="401" height="153" alt="article9_img4.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Yes, that's the modest UserStatus component. But here we can see a little bug. Well this comes from the 6th article where we worked on the basic architecture of FB components. We cared how to create a first functioning FB component, we did not care about details. One detail here is that we forgot to add code that will re-size the text field automatically to fit the length of the Facebook status. We will fix it now and add some other small features. </div>

<div style="text-align: left;">Let's add now the feature to load statuses from the specific friends. Remember the code from the ProfilePicDisplay component?</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">public</span> <span class="category1">function</span> <span class="category2">load</span>(fbook:Facebook, uid:<span class="category2">Number</span>):<span class="category1">void</span> {
 			
 			<span class="category1">var</span> <span class="category2">call</span>:GetInfo = <span class="category1">new</span> GetInfo([uid], [GetInfoFieldValues.PIC_BIG]);
 			<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onInfo);
 			fbook.post(<span class="category2">call</span>);
 
 		}</pre>
</code>

</div></div> 

<div style="text-align: left;">Let's do the same for the status of the user! Not that difficult: </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">public</span> <span class="category1">function</span> <span class="category2">load</span>(fbook:Facebook, uid:<span class="category2">Number</span>):<span class="category1">void</span> {
 			
 			<span class="category1">var</span> <span class="category2">call</span>:GetInfo = <span class="category1">new</span> GetInfo([uid], [GetInfoFieldValues.STATUS]);
 			<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onInfo);
 			fbook.post(<span class="category2">call</span>);
 
 		}</pre>
</code>

</div></div> 

<div style="text-align: left;">Paste this method and replace the loadStatus method. Now in the first frame of the swf, instead of:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

status1_mc.loadStatus(fbook);</pre>
</code>

</div></div> 

<div style="text-align: left;">paste this:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

status1_mc.<span class="category2">load</span>(fbook, userID);</pre>
</code>

</div></div>

<div style="text-align: left;">Where userID is the uid of one of your friends. I took for example:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

status1_mc.<span class="category2">load</span>(fbook, 1199659818);</pre>
</code>

</div></div> 

<div style="text-align: left;">And the result is: </div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img5.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img5.html','popup','width=382,height=125,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img5-thumb-382x125.png" width="382" height="125" alt="article9_img5.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Cool, we just loaded the status of one of our friends. Now we are able to place multiple UserStatus components and play around with it. The final thing we need to add is the resizing of the text field. We will do that by adding some code the the existing onInfo method. Here is the code:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">private</span> <span class="category1">function</span> onInfo(e:FacebookEvent):<span class="category1">void</span>{
 			
 			<span class="category1">var</span> user = (e.<span class="category2">data</span> as GetInfoData).userCollection.<span class="category2">getItemAt</span>(0) as FacebookUser;
 			_status_txt.<span class="category2">text</span> = user.<span class="category2">status</span>.<span class="category2">message</span>;
 			_status_txt.<span class="category2">width</span> = _status_txt.<span class="category2">textWidth</span>;
 		
}</pre>
</code>

</div></div>

<div style="text-align: left;">Now take one friend with a longer user id, in my case I took my own status that was cut off previously:</div>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img6.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img6.html','popup','width=351,height=113,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img6-thumb-351x113.png" width="351" height="113" alt="article9_img6.png" class="mt-image-none" style="" /></a></span>
<div style="text-align: left;">
We see now that in this case the text field is stretched and the whole string is displayed.</div> <div style="text-align: left;">Wow, finally the component is ready to go and we are able to do neat things with it. Now, we need to load the statuses.</div>

<div style="text-align: left;">The code that loads the friends was already discussed but this time it's a bit different. What do we need actually? We need an array that has the element with the following properties: user id, friend's name, profile picture, status. So let's go to work. On the first frame we have the code that creates the session. Now we need to remove the code that loads the data into status1_mc, so here is what is left on frame 1:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoData;
<span class="category1">import</span> com.facebook.utils.FacebookSessionUtil;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.FacebookUser;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoFieldValues;
<span class="category1">import</span> com.facebook.commands.users.GetInfo;
<span class="category1">import</span> com.facebook.commands.friends.*;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.friends.*;
<span class="category1">import</span> com.facebook.net.FacebookCall;
<span class="category1">import</span> com.facebook.events.FacebookEvent;
<span class="category1">import</span> com.facebook.Facebook;

<span class="category1">var</span> fbook:Facebook;
<span class="category1">var</span> session:FacebookSessionUtil;
<span class="category1">var</span> user:FacebookUser;
<span class="category1">var</span> users:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
<span class="category1">var</span> uids:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();

session = <span class="category1">new</span> FacebookSessionUtil("<span class="quote">YOUR_API_KEY</span>", "<span class="quote">YOUR_SECRET</span>", loaderInfo);
fbook = session.facebook;</pre>
</code>

</div></div> 

<div style="text-align: left;">Right below that, we should add code that loads the list of friends:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">var</span> <span class="category2">call</span>:GetFriends = <span class="category1">new</span> GetFriends();
<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onFriends);
fbook.post(<span class="category2">call</span>);</pre>
</code>

</div></div> 

<div style="text-align: left;">Right after the call, we need to create the onFriends callback that will receive all friends:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">function</span> onFriends(e:FacebookEvent):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> friends = (e.<span class="category2">data</span> as GetFriendsData).friends;
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = friends.<span class="category2">length</span>;
 	
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = friends.<span class="category2">getItemAt</span>(i) as FacebookUser;
  		uids.<span class="category2">push</span>(user.uid);
  	}
 		
 	<span class="category2">trace</span>(uids);
 
}</pre>
</code>

</div></div>

<div style="text-align: left;">In order to get all the data we need, first we need to create a small array containing the list of all uids of our friends. This is created in the onFriends method using the loop. Now when this code is uploaded is should display a list of user ids: </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

2022256,38503512,61802896...</pre>
</code>

</div></div>

<div style="text-align: left;">OK, now that we have the user ids we will pass them to the next Facebook call to get the desired information of friends:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">var</span> <span class="category2">call</span>:FacebookCall = fbook.post(<span class="category1">new</span> GetInfo(uids, [&amp;#8220;stauts&amp;#8221;]));
<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onDataRecieve);
    fbook.post(<span class="category2">call</span>);</pre>
</code>

</div></div> 

<div style="text-align: left;">This call needs to be added inside the onFriends method, so here is the complete method:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">function</span> onFriends(e:FacebookEvent):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> friends = (e.<span class="category2">data</span> as GetFriendsData).friends;
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = friends.<span class="category2">length</span>;
 	<span class="category1">var</span> uids:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = friends.<span class="category2">getItemAt</span>(i) as FacebookUser;
  		uids.<span class="category2">push</span>(user.uid);
  	}
 		
 	<span class="category1">var</span> <span class="category2">call</span>:FacebookCall = fbook.post(<span class="category1">new</span> GetInfo(uids, &amp;#8220;<span class="category2">status</span>&amp;#8221;]));
 <span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onDataRecieve);
     fbook.post(<span class="category2">call</span>);
 	
}</pre>
</code>

</div></div> 

<div style="text-align: left;">Ok, before we test the code, we really need to make sure that some method receives the data about friends, we already nemed it onDataReceive and look like this:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">function</span> onDataRecieve(e:FacebookEvent){
 	<span class="category1">var</span> userData = ((e.<span class="category2">data</span> as GetInfoData).userCollection);
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = userData.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = userData.<span class="category2">getItemAt</span>(i);
  		<span class="category1">var</span> dataObj = <span class="category1">new</span> <span class="category2">Object</span>();
  		<span class="category2">trace</span>(user.<span class="category2">status</span>.<span class="category2">message</span>, uids[i]);
  		
  	}
 	
}</pre>
</code>

</div></div> 

<div style="text-align: left;">Now we need to compile the swf and upload it. We should see the list in the output that has the following format:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

Status, user id</pre>
</code>

</div></div> 

<div style="text-align: left;">In my case it looks like this:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

Some <span class="category2">status</span>, 1110516263
Some other <span class="category2">status</span>, 1114566654
Other <span class="category2">status</span>, 1118563211
.
.
.</pre>
</code>

</div></div>

<div style="text-align: left;">Now we have the data, but the data also need to be stored. Here is how it can be done:
In every loop iteration we create an object with the data above and push it as an array element. </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoData;
<span class="category1">import</span> com.facebook.utils.FacebookSessionUtil;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.FacebookUser;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoFieldValues;
<span class="category1">import</span> com.facebook.commands.users.GetInfo;
<span class="category1">import</span> com.facebook.commands.friends.*;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.friends.*;
<span class="category1">import</span> com.facebook.net.FacebookCall;
<span class="category1">import</span> com.facebook.events.FacebookEvent;
<span class="category1">import</span> com.facebook.Facebook;

<span class="category1">var</span> fbook:Facebook;
<span class="category1">var</span> session:FacebookSessionUtil;
<span class="category1">var</span> user:FacebookUser;
<span class="category1">var</span> users:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
<span class="category1">var</span> uids:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();

session = <span class="category1">new</span> FacebookSessionUtil("<span class="quote">YOUR_API_KEY</span>", "<span class="quote">YOUR_SECRET</span>", loaderInfo);
fbook = session.facebook;

<span class="category1">var</span> <span class="category2">call</span>:GetFriends = <span class="category1">new</span> GetFriends();
<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onFriends);
fbook.post(<span class="category2">call</span>);

<span class="category1">function</span> onFriends(e:FacebookEvent):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> friends = (e.<span class="category2">data</span> as GetFriendsData).friends;
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = friends.<span class="category2">length</span>;
 	
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = friends.<span class="category2">getItemAt</span>(i) as FacebookUser;
  		uids.<span class="category2">push</span>(user.uid);
  	}
 		
 	<span class="category1">var</span> <span class="category2">call</span>:FacebookCall = fbook.post(<span class="category1">new</span> GetInfo(uids, ["<span class="quote">status</span>"]));
 	<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onDataRecieve);
     fbook.post(<span class="category2">call</span>);
 
}

<span class="category1">function</span> onDataRecieve(e:FacebookEvent){
 	<span class="category1">var</span> userData = ((e.<span class="category2">data</span> as GetInfoData).userCollection);
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = userData.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = userData.<span class="category2">getItemAt</span>(i);
  		<span class="category1">var</span> dataObj = <span class="category1">new</span> <span class="category2">Object</span>();
  		dataObj.<span class="category2">status</span> = user.<span class="category2">status</span>.<span class="category2">message</span>;
  		dataObj.uid = uids[i];
  		users[i] = dataObj;
  	}
 	
}</pre>
</code>

</div></div> 

<div style="text-align: left;">Well now I think we are ready for the next step. The next step is to implement the logic that is necessary for the application flow. There will be 7 (if you want more) status components of the screen. </div>

<div style="text-align: left;">We can enhance the Status component to display the profile pic and the status in one movieclip. For that, we will extend the UserStatus component.</div>

<div style="text-align: left;">Duplicate the UserStatus component and name it UserStatusPlus. </div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img12.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img12.html','popup','width=331,height=310,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img12-thumb-331x310.png" width="331" height="310" alt="article9_img12.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">In our library, we should have now the UserStatusPlus component right below the original one. </div>
<div style="text-align: left;">
Open he UserStatusPlus in edit mode:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img13.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img13.html','popup','width=497,height=228,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img13-thumb-400x183.png" width="400" height="183" alt="article9_img13.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Change the height of the dummy rectangle to 50 px.</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img14.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img14.html','popup','width=457,height=120,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img14-thumb-400x105.png" width="400" height="105" alt="article9_img14.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Go back to the main timeline, select the UserStatusPlus component and give it the following linkage options:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img15.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img15.html','popup','width=517,height=438,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img15-thumb-400x338.png" width="400" height="338" alt="article9_img15.png" class="mt-image-none" style="" /></a></span>

<div style="text-align: left;">This means we need to create inheritance. Here is the code for the extended component:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

package facebookUI{
 
 	<span class="category1">import</span> com.facebook.Facebook;
 	<span class="category1">import</span> facebookUI.ProfilePicDisplay;
 
 	<span class="category1">public</span> <span class="category1">class</span> UserStatusPlus <span class="category1">extends</span> UserStatus{
  
  		protected <span class="category1">var</span> _profilePic_mc = <span class="category1">null</span>;
  
  		<span class="category1">function</span> UserStatusPlus() {
   		}
  
  		override protected <span class="category1">function</span> configUI():<span class="category1">void</span> {
   
   			<span class="category1">super</span>.configUI();
   
   			_profilePic_mc = <span class="category1">new</span> ProfilePicDisplay();
   			addChild(_profilePic_mc);
   			_profilePic_mc.<span class="category2">setSize</span>(50, 50);
   
   			_status_txt.<span class="category2">x</span> = _profilePic_mc.<span class="category2">width</span>;
   
   		}
  
  		override <span class="category1">public</span>  <span class="category1">function</span> <span class="category2">load</span>(fbook:Facebook, uid:<span class="category2">Number</span>):<span class="category1">void</span> {
   			
   			<span class="category1">super</span>.<span class="category2">load</span>(fbook, uid);
   			_profilePic_mc.<span class="category2">load</span>(fbook, uid);
   
   		}
  
  	}
 
}</pre>
</code>

</div></div> 

<div style="text-align: left;">Save it as UserStatusPlus.as in the same facebookUI folder where all our Facebook classes reside.</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img16.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img16.html','popup','width=578,height=459,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img16-thumb-400x317.png" width="400" height="317" alt="article9_img16.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Now the great thing about this class is that we only need to pass the user id and the status and the profile pic will be displayed. How lovely!
Every time the application user types in a keyword, the application will display max. 7 friends with those keywords in their statuses. This might sound a bit confusing right now, but will be much clearer soon. So, let's place 7 status components below each other like on the image:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img7.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img7.html','popup','width=435,height=297,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img7-thumb-400x273.png" width="400" height="273" alt="article9_img7.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">From top to bottom, in the property inspector, name them status1_mc, status2_mc, etc. respectively. This is the where the statuses of friends will appear as soon as the app user types in a key word. Below we need an input text field, so paste it directly below:</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img8.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img8.html','popup','width=440,height=374,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img8-thumb-400x340.png" width="400" height="340" alt="article9_img8.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">I added a background color so that the search text field can be easily distinguished. Name it search_txt in the property inspector. Cool, now we have to add the listener that listens when the app user types in some text:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

search_txt.addEventListener(Event.CHANGE, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> <span class="category2">text</span>:<span class="category2">String</span> = e.currentTarget.<span class="category2">text</span>;
 
 	<span class="category2">trace</span>("<span class="quote">Written text: </span>" + <span class="category2">text</span>);
 	
}</pre>
</code>

</div></div> 

<div style="text-align: left;">We need to upload the compiled swf to make sure the listeners works. </div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img9.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img9.html','popup','width=647,height=279,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img9-thumb-400x172.png" width="400" height="172" alt="article9_img9.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">When we are sure that this works, we can begin searching for statuses. </div>

<div style="text-align: left;">We will use now the written text to search for keywords. Every time the app user types in a keyword, we simply iterate through the list of friends and check for the occurrence of this keyword. This algorithm may be a little slow, but can be optimized.  Here is how the the first version of the function might look like: </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

search_txt.addEventListener(Event.CHANGE, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> t:<span class="category2">String</span> = e.currentTarget.<span class="category2">text</span>;
 	sT(t);
 	
}

<span class="category1">function</span> sT(t:<span class="category2">String</span>):<span class="category2">Array</span>{
 	<span class="category1">var</span> i:<span class="category2">Number</span> = 0;
 	<span class="category1">var</span> len:<span class="category2">Number</span> = users.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user:<span class="category2">Object</span> = users[i];
  		<span class="category1">if</span>(user.<span class="category2">status</span>.<span class="category2">indexOf</span>(t) != -1){
   			<span class="category2">trace</span>(user.<span class="category2">status</span>);
   		}
  	}
 	<span class="category1">return</span> [];
}</pre>
</code>

</div></div> 

<div style="text-align: left;">The method name sT was shortened because of performance reasons. When we compile and upload, we will quickly see that the method is too slow. For the Flash player, it's too overwhelming to iterate 200 or more times (depends on how many friends we have)  every time we type in a character. A better way might be to place a search button on the stage and make the search when the word is typed in a the button is pressed. In order for that to happen, we don&#8217;t need the change event anymore:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

search_txt.addEventListener(Event.CHANGE, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> t:<span class="category2">String</span> = e.currentTarget.<span class="category2">text</span>;
 	sT(t);
 	
}</pre>
</code>

</div></div> 

<div style="text-align: left;">We need to place one button beside the text field, give it a label "Search" and the instance name search_btn. </div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img10.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img10.html','popup','width=550,height=179,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img10-thumb-400x130.png" width="400" height="130" alt="article9_img10.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Now, we need to call the search method as so as the app user hits the search button. Here is the code: </div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

search_btn.addEventListener(MouseEvent.CLICK, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	<span class="category1">var</span> t:<span class="category2">String</span> = search_txt.<span class="category2">text</span>;
 	sT(t);
}

<span class="linecomment">//same search function</span>
<span class="category1">function</span> sT(t:<span class="category2">String</span>):<span class="category2">Array</span>{
 	<span class="category1">var</span> i:<span class="category2">Number</span> = 0;
 	<span class="category1">var</span> len:<span class="category2">Number</span> = users.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user:<span class="category2">Object</span> = users[i];
  		<span class="category1">if</span>(user.<span class="category2">status</span>.<span class="category2">indexOf</span>(t) != -1){
   			<span class="category2">trace</span>(user.<span class="category2">status</span>);
   		}
  	}
 	<span class="category1">return</span> [];
}</pre>
</code>

</div></div> 

<div style="text-align: left;">Now when the swf is uploaded we can type in a word, like in my sample "dogs" I get one of my friends who has dogs and similar stuff on his mind. </div>

<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img11.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img11.html','popup','width=521,height=210,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img11-thumb-400x161.png" width="400" height="161" alt="article9_img11.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Now there is still a lot to do here. The search method is not yet finished. Until now it only shows the status of the user that has the keyword inside. In reality we want to see the image of the friends with his status displayed as soon as keywords are found.</div>

<div style="text-align: left;">For that, the whole search algorithm looks like this:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

search_btn.addEventListener(MouseEvent.CLICK, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	<span class="category1">var</span> t:<span class="category2">String</span> = search_txt.<span class="category2">text</span>;
 	<span class="category1">var</span> found:<span class="category2">Array</span> = sT(t);
 	<span class="category2">trace</span>("<span class="quote">Found: </span>" + found[0].<span class="category2">status</span>);
}

<span class="category1">function</span> sT(t:<span class="category2">String</span>):<span class="category2">Array</span>{
 	<span class="category1">var</span> found:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
 	<span class="category1">var</span> i:<span class="category2">Number</span> = 0;
 	<span class="category1">var</span> len:<span class="category2">Number</span> = users.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user:<span class="category2">Object</span> = users[i];
  		<span class="category1">if</span>(user.<span class="category2">status</span>.<span class="category2">indexOf</span>(t) != -1){
   			found.<span class="category2">push</span>(user);
   		}
  	}
 	<span class="category1">return</span> found;
}</pre>
</code>

</div></div>

<div style="text-align: left;">Ok, let's test it! When uploaded and when we type a keyword, instead of the status, a whole object with information about the user appears. </div>

Found: Greg Lynch is really really really really really really really happy the dogs came back from the Vet tinted bright yellow and smelling once again of sulfur. Only four more visits until they are better.

<div style="text-align: left;">Ok, now we to change the changed method in order to display the results:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	<span class="category1">var</span> t:<span class="category2">String</span> = search_txt.<span class="category2">text</span>;
 	<span class="category1">var</span> found:<span class="category2">Array</span> = sT(t);
 	<span class="category1">var</span> i = 0;
 	<span class="category1">var</span> len = found.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">this</span>["<span class="quote">status</span>" + (i + 1) + "<span class="quote">_mc</span>"].<span class="category2">load</span>(fbook, found[i].uid);
  	}
}</pre>
</code>

</div></div> 

<div style="text-align: left;">When uploaded it should look similar like in the image below.</div>
<br/>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.insideria.com/assets_c/2009/05/article9_img18.html" onclick="window.open('http://www.insideria.com/assets_c/2009/05/article9_img18.html','popup','width=581,height=382,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.insideria.com/assets_c/2009/05/article9_img18-thumb-400x262.png" width="400" height="262" alt="article9_img18.png" class="mt-image-none" style="" /></a></span>
<br/>
<div style="text-align: left;">Finally, not to confuse you, here is the complete code from frame 1:</div>

<div class="acode" style="overflow:auto;padding:10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre>

<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoData;
<span class="category1">import</span> com.facebook.utils.FacebookSessionUtil;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.FacebookUser;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.users.GetInfoFieldValues;
<span class="category1">import</span> com.facebook.commands.users.GetInfo;
<span class="category1">import</span> com.facebook.commands.friends.*;
<span class="category1">import</span> com.facebook.<span class="category2">data</span>.friends.*;
<span class="category1">import</span> com.facebook.net.FacebookCall;
<span class="category1">import</span> com.facebook.events.FacebookEvent;
<span class="category1">import</span> com.facebook.Facebook;

<span class="category1">var</span> fbook:Facebook;
<span class="category1">var</span> session:FacebookSessionUtil;
<span class="category1">var</span> user:FacebookUser;
<span class="category1">var</span> users:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
<span class="category1">var</span> uids:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();

session = <span class="category1">new</span> FacebookSessionUtil("<span class="quote">YOUR_API_KEY</span>", "<span class="quote">YOUR_SECRET</span>", loaderInfo);
fbook = session.facebook;

<span class="category1">var</span> <span class="category2">call</span>:GetFriends = <span class="category1">new</span> GetFriends();
<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onFriends);
fbook.post(<span class="category2">call</span>);

<span class="category1">function</span> onFriends(e:FacebookEvent):<span class="category1">void</span>{
 	
 	<span class="category1">var</span> friends = (e.<span class="category2">data</span> as GetFriendsData).friends;
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = friends.<span class="category2">length</span>;
 	
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = friends.<span class="category2">getItemAt</span>(i) as FacebookUser;
  		uids.<span class="category2">push</span>(user.uid);
  	}
 		
 	<span class="category1">var</span> <span class="category2">call</span>:FacebookCall = fbook.post(<span class="category1">new</span> GetInfo(uids, ["<span class="quote">status</span>"]));
 	<span class="category2">call</span>.addEventListener(FacebookEvent.COMPLETE, onDataRecieve);
     fbook.post(<span class="category2">call</span>);
 
}

<span class="category1">function</span> onDataRecieve(e:FacebookEvent){
 	<span class="category1">var</span> userData = ((e.<span class="category2">data</span> as GetInfoData).userCollection);
 	<span class="category1">var</span> i;
 	<span class="category1">var</span> len = userData.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user = userData.<span class="category2">getItemAt</span>(i);
  		<span class="category1">var</span> dataObj = <span class="category1">new</span> <span class="category2">Object</span>();
  		dataObj.<span class="category2">status</span> = user.<span class="category2">status</span>.<span class="category2">message</span>;
  		dataObj.uid = uids[i];
  		users[i] = dataObj;
  	}
 	
}

search_btn.addEventListener(MouseEvent.CLICK, changed);

<span class="category1">function</span> changed(e:Event):<span class="category1">void</span>{
 	<span class="category1">var</span> t:<span class="category2">String</span> = search_txt.<span class="category2">text</span>;
 	<span class="category1">var</span> found:<span class="category2">Array</span> = sT(t);
 	<span class="category1">var</span> i = 0;
 	<span class="category1">var</span> len = found.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">this</span>["<span class="quote">status</span>" + (i + 1) + "<span class="quote">_mc</span>"].<span class="category2">load</span>(fbook, found[i].uid);
  	}
}

<span class="category1">function</span> sT(t:<span class="category2">String</span>):<span class="category2">Array</span>{
 	<span class="category1">var</span> found:<span class="category2">Array</span> = <span class="category1">new</span> <span class="category2">Array</span>();
 	<span class="category1">var</span> i:<span class="category2">Number</span> = 0;
 	<span class="category1">var</span> len:<span class="category2">Number</span> = users.<span class="category2">length</span>;
 	<span class="category1">for</span>(i = 0; i &lt; len; i++){
  		<span class="category1">var</span> user:<span class="category2">Object</span> = users[i];
  		<span class="category1">if</span>(user.<span class="category2">status</span>.<span class="category2">indexOf</span>(t) != -1){
   			found.<span class="category2">push</span>(user);
   		}
  	}
 	<span class="category1">return</span> found;
}</pre>
</code>

</div></div> 

<p><br/>To view the entire series please visit <a href="http://www.insideria.com/series-facebook-dev.html">http://www.insideria.com/series-facebook-dev.html</a></p>]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2068150</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2068150" />
    <title>Comment from iphone on 2009-07-13</title>
    <author>
        <name>iphone</name>
        <uri>http://www.simplyfreeiphone.co.uk/</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.simplyfreeiphone.co.uk/">
        <![CDATA[<p>Enhanced status bar with many new options and capabilities:support for mini HTML formatted text in panels, including capability to add hyperlinks, images and blinking text in the statusbar panel.panel with time, date, NUMLock, CAPSLock</p>]]>
    </content>
    <published>2009-07-13T07:45:28Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2073123</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2073123" />
    <title>Comment from Ryan on 2009-08-29</title>
    <author>
        <name>Ryan</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Looks like a pretty good facebook app. With facebook and twitter being the traffic hubs, its important for <a href="http://hintcafe.com">free web dating</a> sites to develop applications to catch downstream from fb, twitter. </p>]]>
    </content>
    <published>2009-08-29T08:15:28Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2084716</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2084716" />
    <title>Comment from Jason on 2009-09-05</title>
    <author>
        <name>Jason</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I also agree that it looks like a great app. I currently am working for a <a href="http://www.steverandon.com">New Orleans Wedding photography</a> company and we use twitter and facebook to bring some traffic to our sites. Thanks for the great post!</p>]]>
    </content>
    <published>2009-09-05T17:52:51Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2086188</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2086188" />
    <title>Comment from Christan on 2009-09-06</title>
    <author>
        <name>Christan</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I just love this App, actually I am hooked on facebook. I work at a <a href="htttp://www.golfakademie-gmbh.de">golfshop</a> and I dont get to spend time on the internet that much. </p>]]>
    </content>
    <published>2009-09-06T17:45:57Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2086189</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2086189" />
    <title>Comment from Jason on 2009-09-06</title>
    <author>
        <name>Jason</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I really loved this aplication like the others. I am not the much of a facebook fanatic as most but it does intrest me sometimes. I actually used to work at a <a href="http://www.golfakademie-gmbh.de">Golfshop</a> also. I know boring it can be haha!</p>]]>
    </content>
    <published>2009-09-06T17:50:04Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2109321</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2109321" />
    <title>Comment from Joe Clark on 2009-09-21</title>
    <author>
        <name>Joe Clark</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I have been involved with computers for a very long time, see I have worked for <a href="http://www.pcmedic.co.uk">Solihull laptop screen repairs</a> and I have seen just about everything. I am a avid user of facebook and this app has been really handy for me. Also thanks for the in depth post, its about time. Many blogs these days have very short posts. Thanks</p>]]>
    </content>
    <published>2009-09-22T04:00:12Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2113622</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2113622" />
    <title>Comment from CandyMiller33 on 2009-09-23</title>
    <author>
        <name>CandyMiller33</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I run a great <a href="http://www.satliveonpc.com">live TV premiership</a> and I am int he process of using Facebook to get more people interested in our premiership. I really think that this app is awesome. Thanks so much for the great application.</p>]]>
    </content>
    <published>2009-09-23T23:48:04Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2116645</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2116645" />
    <title>Comment from JamesAllisson on 2009-09-25</title>
    <author>
        <name>JamesAllisson</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I use Facebook since one year to have more people booking me as magician and with my band. Thanks for this app its realy magical. Hope its helping me for my <a href="http://www.band-coverband.de">Coverband & Partyband</a> and <a href="http://www.zauberer-zauberkuenstler-zaubern.de/zauberer/zauberer-stadt/zauberer-koeln-zauberkuenstler-koeln.html">Zauberer Koeln</a></p>]]>
    </content>
    <published>2009-09-25T17:58:09Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2133560</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2133560" />
    <title>Comment from Orlando on 2009-10-09</title>
    <author>
        <name>Orlando</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I really loved this aplication like the others. I mostly spent time on face book and have many friends there but i never think about that application now im going to share it with my friends as we have a big community and i work for <a href="http://www.fortuneave.com/chicago-real-estate.html">chicago real estate</a> and i think it gonna help me lots. thanks for sharing nice information with us.</p>]]>
    </content>
    <published>2009-10-09T18:27:11Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2149986</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2149986" />
    <title>Comment from C++ Help on 2009-10-22</title>
    <author>
        <name>C++ Help</name>
        <uri>http://www.assignmentexpert.com/cplusplus.html</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.assignmentexpert.com/cplusplus.html">
        <![CDATA[<p>I find this manual really interesting, thanks a lot!</p>]]>
    </content>
    <published>2009-10-22T09:33:49Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2153694</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2153694" />
    <title>Comment from Plinduma on 2009-10-24</title>
    <author>
        <name>Plinduma</name>
        <uri>http://www.kaufparadies-04.at</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.kaufparadies-04.at">
        <![CDATA[<p>Thank You guys for sharing this very good facebook app! I hope I can do this as good as described...</p>]]>
    </content>
    <published>2009-10-24T09:43:04Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2153916</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2153916" />
    <title>Comment from Susan on 2009-10-24</title>
    <author>
        <name>Susan</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I do absolutely agree with "Orlando" - I love this application like no other! I'm working at a <a href="http://www.kaufparadies-04.at">Plinduma</a> restaurant and we have installed this application in all of our <a href="http://www.kaufparadies-05.at">Plinduma</a> specialities and cards. <br />
I know it sounds weird, but you can't imagine how useful this application is - i guess it saves me hours of work every day!<br />
Thank You!! </p>]]>
    </content>
    <published>2009-10-24T12:23:54Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2009://34.36109-comment:2170018</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2009://34.36109" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2009/06/enhanced-status-component.html#comment-2170018" />
    <title>Comment from Apex Professionals LLC on 2009-11-03</title>
    <author>
        <name>Apex Professionals LLC</name>
        <uri>http://www.squidoo.com/apex-professionals-services-llc</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.squidoo.com/apex-professionals-services-llc">
        <![CDATA[<p>I really loved this aplication like the others. I mostly spent time on face book and have many friends there but i never think about that application now im going to share it with my friends as we have a big community</p>]]>
    </content>
    <published>2009-11-03T16:29:01Z</published>
  </entry>

</feed
