<?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>Xavi Colomer&#039;s Blog &#187; Actionscript 3</title>
	<atom:link href="http://blog.ncatstudios.com/category/actionscript3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ncatstudios.com</link>
	<description>Web technologies and Interactivity ramblings</description>
	<lastBuildDate>Mon, 30 May 2011 14:01:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Webcam silhouette extraction using Pixel Bender</title>
		<link>http://blog.ncatstudios.com/2010/10/10/webcam-silhouette-extraction-using-pixel-bender/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
		<comments>http://blog.ncatstudios.com/2010/10/10/webcam-silhouette-extraction-using-pixel-bender/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 12:28:16 +0000</pubDate>
		<dc:creator>Xavi Colomer</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Pixel Bender]]></category>

		<guid isPermaLink="false">http://blog.ncatstudios.com/?p=302</guid>
		<description><![CDATA[
			
				
			
		
Hello Everybody!
This is just an afternoon proof of concept I made for a project that needs this feature. The mission of this development is to extract the people in front of the camera, and although the extraction must be improved widely, you can see below the first results

In order to achieve this I used flash [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.ncatstudios.com%2F2010%2F10%2F10%2Fwebcam-silhouette-extraction-using-pixel-bender%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello Everybody!</p>
<p>This is just an afternoon proof of concept I made for a project that needs this feature. The mission of this development is to extract the people in front of the camera, and although the extraction must be improved widely, you can see below the first results</p>
<p><object id="FaceMeFilter2" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540px" height="960px" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="qualitiy" value="high" /><param name="menu" value="false" /><param name="src" value="http://blog.ncatstudios.com/wp-content/uploads/2010/10/FaceMeFilter2.swf" /><embed id="FaceMeFilter1" type="application/x-shockwave-flash" width="540px" height="960px" src="http://blog.ncatstudios.com/wp-content/uploads/2010/10/FaceMeFilter2.swf" menu="false" qualitiy="high"></embed></object></p>
<p>In order to achieve this I used flash and Pixel Bender. The algorithm to achieve this results is mine and probably for that reason is not very optimized <img src='http://blog.ncatstudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What I do, basically is retrieve the absoulte values of the RGB channel substraction between the empty room image values and the camera stream, then I compare the average of this result with the tolerance and if is inside the ratio, Bingo! just render it!</p>
<p><strong>Problems I found doing this POC:</strong></p>
<p>- Lack of Pixel Bender documentation, although I finally found what I need.</p>
<p>- When you take the first screenshot and then you seat in front of the webcam, you may provoque some changes in the lights of the room, this has as a result some rendering problems, but most of them should be solved adjusting tolerance.</p>
<p>- You shouldn&#8217;t wear any color that is at the same time in the first picture ( the one without you )</p>
<p>- Poor quality webcams generates more pixeled renderings, that can be solved on the flash side, smoothing the webcam stream, and on the pixel bender side improving the algorithm.</p>
<p>- Poor quality webcams adds an odd &#8216;stroke&#8217; surrounding the user silhouette</p>
<p><strong>Actionscript tips:</strong></p>
<p>To link the Pixel Bender images to the Actionscript code use this:</p>
<pre><code>
_shader.data.frontImage.input = image1BitmapData;
_shader.data.backImage.input = image2BitmapData;
</code></pre>
<p><code> </code></p>
<p><em>*frontImage and backImage are the names set inside Pixel Bender Code.</em></p>
<p>To run the Pixel Bender Job you must create a new BitmapData with the same size of the input images, and render the result there with the next commands:</p>
<pre><code>
var myJob:ShaderJob = new ShaderJob( _shader, outputBitmapData );
myJob.start(true);
</code></pre>
<p><code> </code></p>
<p><strong>Pixel Bender:</strong></p>
<p><strong></strong><br />
<a href="http://blog.ncatstudios.com/public/PixelBenderExtraction/Difference.pbk">Here</a> you can get the Pixel Bender Code.</p>
<p><strong>A new question came into my mind, if I can send a ByteArray to Pixel Bender and get a modified one, and, Strings can be converted into ByteArrays, can Pixel Bender be used as a Encryption method? I&#8217;ll investigate&#8230; <img src='http://blog.ncatstudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Sure someone already try that</strong></p>
<p>I already tried this using alchemy seems the link is broken, I will try to restore <a href="http://blog.ncatstudios.com/2009/08/21/hiding-the-secret-api-key-with-flex-but-where/">this</a> post soon</p>
<div class="shr-publisher-302"></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.ncatstudios.com/2010/10/10/webcam-silhouette-extraction-using-pixel-bender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex, Amazon S3 and custom headers</title>
		<link>http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
		<comments>http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 10:19:31 +0000</pubDate>
		<dc:creator>Xavi Colomer</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 4]]></category>

		<guid isPermaLink="false">http://blog.ncatstudios.com/?p=68&#038;language=en</guid>
		<description><![CDATA[
			
				
			
		
Update: Seems not be working on the web, sure it&#8217;s some crossdomain issue so I&#8217;ll try to access to a budget ( since you cannot put a crossdomain.xml policy file on your Amazon&#8217;s root folder ) and I&#8217;ll update this post then 
Static and dynamic website objects ( SWF, mp3, images, etc&#8230;) are high bandwith [...]


Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/09/18/new-tool-flex-pmd/' rel='bookmark' title='Permanent Link: New Tool: Flex PMD'>New Tool: Flex PMD</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.ncatstudios.com%2F2009%2F04%2F19%2Fflex-amazon-s3-and-custom-headers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify; "><strong>Update: </strong><em><strong>Seems not be working on the web, sure it&#8217;s some crossdomain issue so I&#8217;ll try to access to a budget ( since you cannot put a crossdomain.xml policy file on your Amazon&#8217;s root folder ) and I&#8217;ll update this post then </strong></em></p>
<p style="text-align: justify; ">Static and dynamic website objects ( SWF, mp3, images, etc&#8230;) are high bandwith consumers, especially dynamic ones liek SWFs due to development issues. If our bandwidth gets collapsed people will take a long time to see our website or even do not come to see it.</p>
<p style="text-align: justify; ">One solution to this problem is to move all these items to Amazon S3 which provides a very good service at low cost.</p>
<p style="text-align: justify; ">There is a library in google code (<a href="http://code.google.com/p/as3awss3lib/">as3awss3lib</a>) I could not get to run, probably because they need the AIR libraries and my  intention was to use the core Flex libraries only. So I decided to investigate how the Amazon S3 API works, and then tried to access this API using HttpService. If you have tried the same thing you&#8217;ve found that not HttpService do not allow custom headers (even if AIR lets you), so I tried to find other ways to put my own headers in httpService, My attempt was to create a connection with the Socket object but soon I found this library (<a href="http://code.google.com/p/as3httpclientlib/">as3httpclientlib</a>) on google code work done and I only had to worry about the connection.</p>
<p style="text-align: justify; ">Here is an example of a simple application ( Having some Security Sandbox Issues, I&#8217;ll check the policies but totally works on local ):</p>
<p style="text-align: justify; ">[SWF]wp-blogfiles/Flex_Amazon.swf, 512, 335[/SWF]</p>
<p style="text-align: justify; ">And the code (to compile this code you will need these libraries: <a href="http://code.google.com/p/as3httpclientlib/">as3httpclientlib</a> and <a href="http://code.google.com/p/as3crypto/">as3crypto</a>):</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-blogfiles/Flex_Amazon.mxml">MXML source</a></p>
<div class="shr-publisher-68"></div>

<p>Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/09/18/new-tool-flex-pmd/' rel='bookmark' title='Permanent Link: New Tool: Flex PMD'>New Tool: Flex PMD</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex &amp; Drupal login ( Actionscript remoteObjects )</title>
		<link>http://blog.ncatstudios.com/2009/04/04/flex-drupal-login-actionscript-remoteobjects/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
		<comments>http://blog.ncatstudios.com/2009/04/04/flex-drupal-login-actionscript-remoteobjects/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 22:57:07 +0000</pubDate>
		<dc:creator>Xavi Colomer</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.ncatstudios.com/?p=52&#038;language=en</guid>
		<description><![CDATA[
			
				
			
		
Hello People!
It has been a long time since my last post so I&#8217;ve decided to post something found interesting. Long ago, seeking a faster way to create my websites I found CMS called Drupal, this CMS provides a lot of very important aspects of a web, such as content creation, scalability and robustness. But as [...]


Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/01/07/creating-your-first-blazeds-project/' rel='bookmark' title='Permanent Link: Creating your first BlazeDS project'>Creating your first BlazeDS project</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/' rel='bookmark' title='Permanent Link: Flex, Amazon S3 and custom headers'>Flex, Amazon S3 and custom headers</a></li>
<li><a href='http://blog.ncatstudios.com/2009/05/18/flex-swf-optimization-i/' rel='bookmark' title='Permanent Link: Flex swf optimization ( I )'>Flex swf optimization ( I )</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.ncatstudios.com%2F2009%2F04%2F04%2Fflex-drupal-login-actionscript-remoteobjects%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello People!</p>
<p>It has been a long time since my last post so I&#8217;ve decided to post something found interesting. Long ago, seeking a faster way to create my websites I found CMS called Drupal, this CMS provides a lot of very important aspects of a web, such as content creation, scalability and robustness. But as you know this blog is basically based on the Flash platform technologies, not Drupal, But I was interested in joining the two sides and make a login.</p>
<p>To follow this tutorial is recommended that you have some knowledge of Drupal and Flex</p>
<p>Requirements</p>
<p>Have a server ( local or remote ) with Drupal</p>
<p><strong>Note: </strong></p>
<p><em><strong>This tutorial was mad with Drupal 6.x but I think you can do it perfectly with the previous version 5.x<br />
</strong></em><br />
To complete this tutorial you will need some modules that do not come with the core ( amfphp and services ) as well as the amfphp server. To install the modules simply unzip them inside drupal_folder/modules but i recommend creating a folder drupal_folder/sites/all/modules and copy them inside. Then it¡s imperative you download the amfphp server and copy the the folder inside the amfphp. ( You should have something like this drupal_folder/modules/amfphp/amfphp, the first amfphp is the module logic and the second is the server.</p>
<p>Now we must activate some options of the modules we just install</p>
<p>- In Services activate Services ( it&#8217;s the only option, you can fail here xD )<br />
- In Services &#8211; servers activate AMFPHP<br />
- In Services &#8211; services activate System Service and User Service</p>
<p>You can go to the Drupal Services option and click on the AMFPHP server, you would see a default message from the server, if you can&#8217;t see it you may missed something.</p>
<p>One more thing before view the Actionscript code, in the Drupal Services menu, inside the Settings Tab, disable the &#8220;Use Keys&#8221; option which is used to provide security when we connect from external applications, and althought this tutorial might be used to create an external login too, we won&#8217;t use keys to simplify the tutorial ( maybe in a next post ) however we will leave the &#8220;Use sessid&#8221; active.</p>
<p>Once you have activate that options ( remember to save once you&#8217;ve activated ) we need to give permissions for anyone to access the services, if not an anonymous user couldn&#8217;t login because it couldn&#8217;t access them. Now we can begin to create our AS3</p>
<p>Before giving the Actionscript code I would like to discuss some aspects of the code:</p>
<p>While creating remoteObjects is easier in mxml I always prefer to avoid it using Actionscript but this meant more time until I found the way to communicate Flex with Drupal because I couldn&#8217;t how I could pass parameters to Drupal, if you&#8217;ve encountered the same problem, I hope this tutorial help.</p>
<p><strong>Note:<br />
<em>Before communicating with any other service you must have your sessid, you&#8217;ll do that connecting with the system.connect service, which will return you an object containing the sessid. If you do not know if your services are working correctly because of your code or because of Drupal, you can execute them directly from the Drupal Services menu, there you can find all the parameters you need to execute any service.</em></strong></p>
<p>Using MXML remoteObject is implemented like this ( using <strong>user.get</strong> as example ) :<br />
id=&#8221;test&#8221;<br />
endpoint=&#8221;http://localhost/drupal/services/amfphp&#8221;<br />
destination=&#8221;amfphp&#8221;<br />
source=&#8221;user&#8221;<br />
result=&#8221;handler_drupalResult( event )&#8221;<br />
fault=&#8221;handler_drupalFault( event )&#8221;&gt;</p>
<p>sessid<br />
1</p>
<p>This service is used to get the information about the user with a certain uid ( user id ). In order to do that you must be logged in.</p>
<p>In Actionscript should be something like this:</p>
<p>drupal.source = &#8220;user&#8221;<br />
var params:Object = new Object();<br />
params.sessid = sessid;<br />
params.uid = 1<br />
<strong>Operation(drupal.getOperation( &#8220;get&#8221; )).argumentNames = ["sessid","uid"]</strong><br />
drupal.getOperation( &#8220;get&#8221; ).arguments = params;<br />
drupal.getOperation( &#8220;get&#8221; ).send();</p>
<p>The lined marked in bold is the one I was searching during hours, this is automatically implemented in the mxml component, if you don&#8217;t put it Drupal will always return &#8220;Missing Arguments&#8221;</p>
<p>Finally, the code:</p>
<p>I hope you find this usefull!!</p>
<div class="shr-publisher-52"></div>

<p>Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/01/07/creating-your-first-blazeds-project/' rel='bookmark' title='Permanent Link: Creating your first BlazeDS project'>Creating your first BlazeDS project</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/' rel='bookmark' title='Permanent Link: Flex, Amazon S3 and custom headers'>Flex, Amazon S3 and custom headers</a></li>
<li><a href='http://blog.ncatstudios.com/2009/05/18/flex-swf-optimization-i/' rel='bookmark' title='Permanent Link: Flex swf optimization ( I )'>Flex swf optimization ( I )</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.ncatstudios.com/2009/04/04/flex-drupal-login-actionscript-remoteobjects/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Creating your first BlazeDS project</title>
		<link>http://blog.ncatstudios.com/2009/01/07/creating-your-first-blazeds-project/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
		<comments>http://blog.ncatstudios.com/2009/01/07/creating-your-first-blazeds-project/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 22:52:45 +0000</pubDate>
		<dc:creator>Xavi Colomer</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.ncatstudios.com/?p=32&#038;language=en</guid>
		<description><![CDATA[
			
				
			
		
Now we&#8217;ve got Adobe Flex configured to work with BlazeDS let&#8217;s start with our first project.
We will do this:
We will create the front-end logic in Actionscript and MXML. 
We will create the back-end logic in JAVA 
We will create the needed config files to establish a bridge or a connection between the front-end and the [...]


Related posts:<ol><li><a href='http://blog.ncatstudios.com/2008/12/18/setting-up-your-blazeds-tomcat-server-on-eclipse-local/' rel='bookmark' title='Permanent Link: Setting up your BlazeDS (tomcat) server on Eclipse ( local )'>Setting up your BlazeDS (tomcat) server on Eclipse ( local )</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/04/flex-drupal-login-actionscript-remoteobjects/' rel='bookmark' title='Permanent Link: Flex &#038; Drupal login ( Actionscript remoteObjects )'>Flex &#038; Drupal login ( Actionscript remoteObjects )</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.ncatstudios.com%2F2009%2F01%2F07%2Fcreating-your-first-blazeds-project%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify; ">Now we&#8217;ve got Adobe Flex configured to work with BlazeDS let&#8217;s start with our first project.</p>
<p style="text-align: justify; "><strong>We will do this:</strong></p>
<p style="text-align: justify; "><em>We will create the front-end logic in Actionscript and MXML. </em></p>
<p style="text-align: justify; "><em>We will create the back-end logic in JAVA </em></p>
<p style="text-align: justify; "><em>We will create the needed config files to establish a bridge or a connection between the front-end and the back-end.</em></p>
<p style="text-align: justify; ">
<p style="text-align: justify; ">So let&#8217;s start creating a new project, this time we want to use a Server technology. Here we must select <strong>J2EE</strong> because tomcat / BlazeDS uses this language / technology and we won&#8217;t touch anything</p>
<p style="text-align: justify; ">you can see the results in the next image:</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_1creating.jpg" rel="lightbox[32]"><img class="aligncenter size-thumbnail wp-image-161" title="4_1creating" src="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_1creating-150x150.jpg" alt="4_1creating" width="150" height="150" /></a></p>
<p style="text-align: justify; "><a href="wp-blogfiles/images/4_1creating.jpg" rel="lightbox[32]"> </a></p>
<p style="text-align: justify; ">At the bottom of the image you&#8217;ll see a check box with this text: <strong>Create combined Java / Flex project using WTP.</strong> In the java source folder will be placed all the raw java files, the logic of the back-end, once you execute the project this logic will be compiled and placed to the server automatically, don&#8217;t worry about that.</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_2creating.jpg" rel="lightbox[32]"><img class="aligncenter size-thumbnail wp-image-162" title="4_2creating" src="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_2creating-150x150.jpg" alt="4_2creating" width="150" height="150" /></a></p>
<p style="text-align: justify; "><a href="wp-blogfiles/images/4_2creating.jpg" rel="lightbox[32]"> </a></p>
<p style="text-align: justify; ">Next we must configure the J2EE settings, the target runtime will be BlazeDS we created in the last post. I always put the same in the Context root and the Content folder, the project name, but in this example I will put context_root and content_folder to show you how the folders and files are created. The project is structured like this:</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_3result.jpg" rel="lightbox[32]"><img class="aligncenter size-thumbnail wp-image-163" title="4_3result" src="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_3result-150x150.jpg" alt="4_3result" width="150" height="150" /></a></p>
<p style="text-align: justify; "><a href="wp-blogfiles/images/4_3result.jpg" rel="lightbox[32]"> </a></p>
<p style="text-align: justify; ">Inside the content_folder to folders has been created: META-INF, and WEB-INF ( this is the important one now&#8230; )</p>
<p style="text-align: justify; ">inside WEB-INF we&#8217;ve got 4 folders:</p>
<p style="text-align: justify; "><strong>classes</strong>: <em>This is the back-end compiled logic created inside the src folder, every time you run the project the JAVA files will be recompiled ( if needed ) and updated inside this folder.</em></p>
<p style="text-align: justify; "><strong>flex</strong>: <em>Here is the messaging configuration you will see 4 files inside this folder but you only need services-config.xml the other files are automatically created for order purposes, if you delete them you will get some errors because you must edit services-config.xml. This file includes the other three, if you delete this inclusions, you can delete the files&#8230; ( of course this files are useful to mantain the messaging structure clean but this is a beginner tutorial!! )</em></p>
<p style="text-align: justify; "><strong>lib</strong>: <em>Some libraries, don&#8217;t need to look here&#8230;</em></p>
<p style="text-align: justify; "><strong>src</strong>: <em>Don&#8217;t need to look here either&#8230;</em></p>
<p style="text-align: justify; "><strong>web.xml</strong> <em>configuration file, we won&#8217;t edit this.</em></p>
<p style="text-align: justify; ">OK.</p>
<p style="text-align: justify; ">Now we&#8217;ve got our structure created the first thing we must do is add our project to our server, this will create a new folder inside the backend with the name of the project and this will contain a copy of our recently created content_folder.</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_4addServer.jpg" rel="lightbox[32]"><img class="aligncenter size-thumbnail wp-image-164" title="4_4addServer" src="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_4addServer-150x150.jpg" alt="4_4addServer" width="150" height="150" /></a></p>
<p style="text-align: justify; "><a href="wp-blogfiles/images/4_4addServer.jpg" rel="lightbox[32]"> </a></p>
<p style="text-align: justify; ">Now we will delete all the files inside content_folder -&gt; WEB-INF -&gt; flex except for services-config.xml, and we will edit the services node like this:</p>
<pre lang="xml"> 	            	com.ncatstudios.remoting.Test</pre>
<p style="text-align: justify; ">The important parts of this piece of XML are the destination and the source. The destination is like the address of the wharehouse where to fetch the data. We must call somewhere from flex to access the data, this name must be the same both sides. The source is the name of the JAVA class ( package doted format ) where we will call the methods.</p>
<p style="text-align: justify; ">Finally here is the code to run the application:</p>
<p style="text-align: justify; ">
<p style="text-align: justify; ">and the JAVA logic:</p>
<pre lang="JAVA">package com.ncatstudios.remoting;

public class Test {

	public String sayHelloTo(String who)
	{
		return "Hello " + who;
	}

}</pre>
<p style="text-align: justify; ">
<p style="text-align: justify; ">Now you can run the application to test it.</p>
<p style="text-align: justify; ">Possible error / bug: I found that sometimes my application doesn&#8217;t run as it should.</p>
<p style="text-align: justify; "><a href="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_5error.jpg" rel="lightbox[32]"><img class="aligncenter size-thumbnail wp-image-165" title="4_5error" src="http://blog.ncatstudios.com/wp-content/uploads/2009/09/4_5error-150x150.jpg" alt="4_5error" width="150" height="150" /></a></p>
<p style="text-align: justify; "><a href="wp-blogfiles/images/4_5error.jpg" rel="lightbox[32]"> </a></p>
<p style="text-align: justify; ">If you open the project properties, inside the Flex Server section just delete the folder of the root URL, leave it to http://localhost:8080, you probably won&#8217;t need to edit this for rest of the life of this project.</p>
<p style="text-align: justify; ">
<p style="text-align: justify; ">
<div class="shr-publisher-32"></div>

<p>Related posts:<ol><li><a href='http://blog.ncatstudios.com/2008/12/18/setting-up-your-blazeds-tomcat-server-on-eclipse-local/' rel='bookmark' title='Permanent Link: Setting up your BlazeDS (tomcat) server on Eclipse ( local )'>Setting up your BlazeDS (tomcat) server on Eclipse ( local )</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/04/flex-drupal-login-actionscript-remoteobjects/' rel='bookmark' title='Permanent Link: Flex &#038; Drupal login ( Actionscript remoteObjects )'>Flex &#038; Drupal login ( Actionscript remoteObjects )</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.ncatstudios.com/2009/01/07/creating-your-first-blazeds-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3, e4x, xml and filtering using Regular expressions (regExp)</title>
		<link>http://blog.ncatstudios.com/2008/12/22/flex-3-e4x-xml-and-filtering-using-regular-expressions-regexp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link>
		<comments>http://blog.ncatstudios.com/2008/12/22/flex-3-e4x-xml-and-filtering-using-regular-expressions-regexp/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 00:42:54 +0000</pubDate>
		<dc:creator>Xavi Colomer</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Optimization]]></category>

		<guid isPermaLink="false">http://blog.ncatstudios.com/?p=20&#038;language=en</guid>
		<description><![CDATA[
			
				
			
		
One of the best improvements of AS3 is the inclusion of native support for parsing xml with e4x. E4X give us the possibility of parsing xml data as objects.
You can access the information using &#8220;dot&#8221; notation ie node_name.node_child_node_child&#8230;
As any technology there are advantatges and disadvantatges:
Advantatges:
This technology is fast to write, very intuitive and saves a [...]


Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/05/18/flex-swf-optimization-i/' rel='bookmark' title='Permanent Link: Flex swf optimization ( I )'>Flex swf optimization ( I )</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/' rel='bookmark' title='Permanent Link: Flex, Amazon S3 and custom headers'>Flex, Amazon S3 and custom headers</a></li>
<li><a href='http://blog.ncatstudios.com/2009/05/21/compile-css-to-swf-memory-bottleneck/' rel='bookmark' title='Permanent Link: Compile CSS to SWF memory bottleneck'>Compile CSS to SWF memory bottleneck</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.ncatstudios.com%2F2008%2F12%2F22%2Fflex-3-e4x-xml-and-filtering-using-regular-expressions-regexp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify; ">One of the best improvements of AS3 is the inclusion of native support for parsing xml with e4x. E4X give us the possibility of parsing xml data as objects.</p>
<p style="text-align: justify; ">You can access the information using &#8220;dot&#8221; notation ie node_name.node_child_node_child&#8230;</p>
<p style="text-align: justify; ">As any technology there are advantatges and disadvantatges:</p>
<p style="text-align: justify; "><strong>Advantatges:</strong></p>
<p style="text-align: justify; ">This technology is fast to write, very intuitive and saves a lot of typing.</p>
<p style="text-align: justify; "><strong>Disadvantatges:</strong></p>
<p style="text-align: justify; ">You must be careful about what are you filtering, large xml means an increasing of flash player time to parse the file, which is stored in memory temporarely, and this is a quite important performance issue.</p>
<p style="text-align: justify; ">In the next example you can find how can you filter a xml file using this technique:</p>
<p style="text-align: justify; ">[SWF]wp-blogfiles/bin-release/regex.swf, 500, 576[/SWF]</p>
<p style="text-align: justify; ">And here some code:</p>
<pre lang="actionscript3">private var _xml:XML;		

private function init():void
{
        loadXML("../assets/XML/texts.xml");
}

private function loadXML(xml:String):void
{
        var loader:URLLoader = new URLLoader();
	loader.addEventListener(Event.COMPLETE, handler_xmlIsLoadedCorrectly);
	loader.dataFormat = "e4x"
	loader.load(new URLRequest(xml));
}

private function handler_xmlIsLoadedCorrectly(event:Event):void
{
	_xml = new XML(event.target.data);
	TA_Xml.text = _xml.toString()
}

private function handler_searchStringIsChanged(event:Event):void
{
	var reg:RegExp = new RegExp(TI_SearchString.text);
	TI_Results.text = _xml..item.(reg.test(text)).@id
}</pre>
<p style="text-align: justify; ">I hope you find it useful!</p>
<div class="shr-publisher-20"></div>

<p>Related posts:<ol><li><a href='http://blog.ncatstudios.com/2009/05/18/flex-swf-optimization-i/' rel='bookmark' title='Permanent Link: Flex swf optimization ( I )'>Flex swf optimization ( I )</a></li>
<li><a href='http://blog.ncatstudios.com/2009/04/19/flex-amazon-s3-and-custom-headers/' rel='bookmark' title='Permanent Link: Flex, Amazon S3 and custom headers'>Flex, Amazon S3 and custom headers</a></li>
<li><a href='http://blog.ncatstudios.com/2009/05/21/compile-css-to-swf-memory-bottleneck/' rel='bookmark' title='Permanent Link: Compile CSS to SWF memory bottleneck'>Compile CSS to SWF memory bottleneck</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.ncatstudios.com/2008/12/22/flex-3-e4x-xml-and-filtering-using-regular-expressions-regexp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

