<?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/"
	>

<channel>
	<title>Web App Solution Blog</title>
	<atom:link href="http://www.webappsolution.com/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webappsolution.com/wordpress</link>
	<description>When you're in need of an appsolution</description>
	<pubDate>Thu, 07 Apr 2011 11:56:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Make a SWFLoader Scroll</title>
		<link>http://www.webappsolution.com/wordpress/2011/04/07/how-to-make-a-swfloader-scroll/</link>
		<comments>http://www.webappsolution.com/wordpress/2011/04/07/how-to-make-a-swfloader-scroll/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 11:56:25 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[fix]]></category>

		<category><![CDATA[scrollbars]]></category>

		<category><![CDATA[scrolling]]></category>

		<category><![CDATA[swfloader]]></category>

		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=1006</guid>
		<description><![CDATA[By default, the SWFLoader doesn&#8217;t scroll so developers often wrap it in a scrolling mx container like a Canvas (since it does scroll and it&#8217;s scroll policies are set to auto). What I didn&#8217;t think about was that I&#8217;d have to know the actual size of the content I was loading in order for the [...]]]></description>
			<content:encoded><![CDATA[<p>By default, the SWFLoader doesn&#8217;t scroll so developers often wrap it in a scrolling mx container like a Canvas (since it does scroll and it&#8217;s scroll policies are set to auto). What I didn&#8217;t think about was that I&#8217;d have to know the actual size of the content I was loading in order for the scrollbars to appear. I tested this in both an MX Application and a Spark Application with Flex SDK 4.5 and achieved the same results.</p>
<p>To reiterate, my small test app below suggests that <strong><em>developers must know the size of the content they are loading in SWFLoader in order for the scrollbars to appear around that loaded content. </em></strong></p>
<p>When I think about it, it makes sense&#8230;at the same time it caught me by surprise when I first implemented it in an app. Hoping this piece of info helps developers loading legacy or 3rd party SWFs they don&#8217;t have control over.</p>
<pre class="brush: as3;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application
	xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
	xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
	xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
	minWidth=&quot;0&quot;
	minHeight=&quot;0&quot;
	creationComplete=&quot;init(event)&quot;
	backgroundColor=&quot;#FF0000&quot;
	&gt;

	&lt;fx:Script&gt;
		&lt;![CDATA[
			import mx.containers.Canvas;
			import mx.controls.SWFLoader;
			import mx.events.FlexEvent;

			protected function init(event:FlexEvent):void
			{
				var swfLoaderContainer:Canvas = new Canvas();
				swfLoaderContainer.percentWidth = 100;
				swfLoaderContainer.percentHeight = 100;
				this.addElement(swfLoaderContainer);

				var swfLoader:SWFLoader = new SWFLoader();
				swfLoader.width = 1200; // does not add scroll bar
				swfLoader.height = 800; // does not add scroll bar
//				swfLoader.percentWidth = 100; // DOES NOT add scroll bar
//				swfLoader.percentHeight = 100; // DOES NOT add scroll bar
				swfLoader.scaleContent = false;
				swfLoaderContainer.addElement(swfLoader);

				var context:LoaderContext = new LoaderContext(false, new ApplicationDomain());
				swfLoader.loaderContext = context;
				swfLoader.load(&quot;SWFToLoad.swf&quot;);
			}

		]]&gt;
	&lt;/fx:Script&gt;

&lt;/s:Application&gt;
</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=How+to+Make+a+SWFLoader+Scroll+http://tinyurl.com/3wogy2k" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=How+to+Make+a+SWFLoader+Scroll+http://tinyurl.com/3wogy2k" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2011/04/07/how-to-make-a-swfloader-scroll/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting Flex Spark &amp; MX Components to Use Embedded Fonts :: Part 2</title>
		<link>http://www.webappsolution.com/wordpress/2011/04/06/getting-flex-spark-mx-components-to-use-embedded-fonts-part-2/</link>
		<comments>http://www.webappsolution.com/wordpress/2011/04/06/getting-flex-spark-mx-components-to-use-embedded-fonts-part-2/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 17:19:09 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[flex builder]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[embedded-fonts]]></category>

		<category><![CDATA[legend]]></category>

		<category><![CDATA[mx]]></category>

		<category><![CDATA[spark]]></category>

		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=990</guid>
		<description><![CDATA[In my last post about this I found an ugly workaround in order to get embedded fonts to work in both MX and Spark Components. Since then I&#8217;ve learned the best way to do this is simply to select the checkbox in the Project Properties -> Flex Compiler -> &#8220;Use Flash Text Engine in MX [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webappsolution.com/wordpress/2011/01/20/getting-spark-mx-components-to-use-embedded-fonts/" target="_blank">In my last post about this</a> I found an ugly workaround in order to get embedded fonts to work in both MX and Spark Components. Since then I&#8217;ve learned the best way to do this is simply to select the checkbox in the Project Properties -> Flex Compiler -> &#8220;Use Flash Text Engine in MX Components&#8221; checkbox = true.</p>
<p><strong>NOTE</strong>: Using Flash Builder Burrito and Flex Hero 4.5 &#8212; haven&#8217;t tested to see if this was the previous issue or not but I wanted to make note of it.</p>
<p><img class="alignleft size-full wp-image-995" title="Use Flash Text Engine in MX Components" src="http://www.webappsolution.com/wordpress/wp-content/uploads/2011/04/screen-shot-2011-04-06-at-10348-pm4.png" alt="Use Flash Text Engine in MX Components" width="334" height="268" />This seems to make embedded fonts play nice in both MX and Spark components in almost every situation. The one I couldn&#8217;t seem to get around was mx:Legend.</p>
<p>When I embedded a font and used this compiler setting, I would randomly see only a couple of my legend labels show up. However, by using just a small piece of my old workaround I was soon back in business.</p>
<p><strong>NOTE</strong>: There is one rather large drawback to this though&#8230;you have to embed your font twice &#8212; once for Spark and once for MX.</p>
<p>Your css should look something like this:</p>
<pre class="brush: as3;">
/********************************************************
/ Fonts
/*******************************************************/
@font-face
{
	src: url(&quot;/resources/font/MyriadPro-Regular.otf&quot;);
	font-family: SparkEmbeddedFont;
	font-weight: normal;
	embed-as-cff: true;
}

@font-face
{
	src: url(&quot;/resources/font/MyriadPro-Bold.otf&quot;);
	font-family: SparkEmbeddedFont;
	font-weight: bold;
	embed-as-cff: true;
}

/********************************************************
/ NOTE: Due to an issue with the legend and embedded
/ fonts we need to embed the font as non cff too.
/*******************************************************/
@font-face
{
	src: url(&quot;/resources/font/MyriadPro-Regular.otf&quot;);
	font-family: MXEmbeddedFont;
	font-weight: normal;
	embed-as-cff: false;
}

@font-face
{
	src: url(&quot;/resources/font/MyriadPro-Bold.otf&quot;);
	font-family: MXEmbeddedFont;
	font-weight: bold;
	embed-as-cff: false;
}

/************************************************************
/ Flex Class-Level Styles
/************************************************************/
s|Application
{
	font-family: SparkEmbeddedFont;
	color: #000000;
}

mx|LegendItem, mx|PieSeries
{
	font-family: MXEmbeddedFont;
	font-size: 12;
	textFieldClass: ClassReference(&quot;mx.core.UITextField&quot;);
}
</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Getting+Flex+Spark+%26+MX+Components+to+Use+Embedded+Fonts+%3A%3A+Part+2+http://tinyurl.com/42t5xn3" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Getting+Flex+Spark+%26+MX+Components+to+Use+Embedded+Fonts+%3A%3A+Part+2+http://tinyurl.com/42t5xn3" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2011/04/06/getting-flex-spark-mx-components-to-use-embedded-fonts-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex 4 ModuleManager &amp; CSS Inheriting Styles</title>
		<link>http://www.webappsolution.com/wordpress/2011/03/17/flex-4-modulemanager-css-inheriting-styles/</link>
		<comments>http://www.webappsolution.com/wordpress/2011/03/17/flex-4-modulemanager-css-inheriting-styles/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 22:24:30 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[flex-4]]></category>

		<category><![CDATA[module]]></category>

		<category><![CDATA[module-manager]]></category>

		<category><![CDATA[spark]]></category>

		<category><![CDATA[styles]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=980</guid>
		<description><![CDATA[A client I&#8217;m working with has a Flex 3.5 app that&#8217;s being migrated to 4.5 and one of the immediate issues we ran into (after we got it compiling successfully) was that the modules didn&#8217;t inherit the styles from the main app&#8230;worked fine in 3.5, but not in 4.5, so what gives?
So I created a [...]]]></description>
			<content:encoded><![CDATA[<p>A client I&#8217;m working with has a Flex 3.5 app that&#8217;s being migrated to 4.5 and one of the immediate issues we ran into (after we got it compiling successfully) was that the modules didn&#8217;t inherit the styles from the main app&#8230;worked fine in 3.5, but not in 4.5, so what gives?</p>
<p>So I created a simple PoC with a ModuleLoader and it did indeed pick up on the main apps styles as expected. Next I changed my PoC to resemble the client&#8217;s architecture a bit more and used a ModuleManager to load the module &#8212; low and behold, the module didn&#8217;t inherit the main app&#8217;s styles.</p>
<p>After some reading on Adobe&#8217;s docs I found the following as the key fix:</p>
<p><a href="http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64277-7ffd.html#WS2db454920e96a9e51e63e3d11c0bf69084-7d20" target="_blank">Using the ModuleManager class to load modules</a></p>
<blockquote><p>
You can use the ModuleManager class to load the module. This technique is less abstract than using the  tag, but it does provide you with greater control over how and when the module is loaded.</p>
<p>To use the ModuleManager to load a module in ActionScript:</p>
<ol>
<li>Get a reference to the module’s IModuleInfo interface by using the ModuleManager getModule() method.</li>
<li>Call the interface’s load() method.</li>
<p><strong><font color="#0000FF">The application that loads the module should pass in its moduleFactory property. This lets the module know who its parent style manager is.</font></strong> When using the load() method, you can specify the application’s moduleFactory with the fourth parameter, as the following example shows:</p>
<pre class="brush: as3;">info.load(null, null, null, moduleFactory);</pre>
<li>Use the factory property of the interface to call the create() method and cast the return value as the module’s class. If you are adding the module to a container, you can cast the return value as an IVisualElement (for Spark containers) or a DisplayObject (for MX containers) so that they can be added to the display list.</li>
</ol>
</blockquote>
<p>So the key is passing in a reference to the moduleFactory when calling the ModuleManager.load() method. The 4th parameter is the moduleManager. If you don&#8217;t have a reference the main app lying around, just use:</p>
<pre class="brush: as3;">info.load(null, null, null, FlexGlobals.topLevelApplication.moduleFactory);</pre>
<p><a href="http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64277-7ffd.html#WS2db454920e96a9e51e63e3d11c0bf69084-7d20" target="_blank">Link to Adobe&#8217;s Docs on this.</a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Flex+4+ModuleManager+%26+CSS+Inheriting+Styles+http://mizgd.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Flex+4+ModuleManager+%26+CSS+Inheriting+Styles+http://mizgd.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2011/03/17/flex-4-modulemanager-css-inheriting-styles/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Great Ant Build Series for Flex</title>
		<link>http://www.webappsolution.com/wordpress/2011/02/23/great-ant-build-series-for-flex/</link>
		<comments>http://www.webappsolution.com/wordpress/2011/02/23/great-ant-build-series-for-flex/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 13:54:54 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[ant]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[automated-builds]]></category>

		<category><![CDATA[build-tool]]></category>

		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=970</guid>
		<description><![CDATA[Many people have asked if we use Maven or Ant for Flex builds&#8230;while we like Maven for Java, we don&#8217;t like Maven for Flex. It&#8217;s not that we don&#8217;t like Maven in general (obviously since we&#8217;re cool with it for Java), we just found it&#8217;s almost too much trouble with Flex. It never fails to [...]]]></description>
			<content:encoded><![CDATA[<p>Many people have asked if we use <a href="http://maven.apache.org/" target="_blank">Maven</a> or <a href="http://ant.apache.org/" target="_blank">Ant</a> for Flex builds&#8230;while we like Maven for Java, we don&#8217;t like Maven for Flex. It&#8217;s not that we don&#8217;t like Maven in general (obviously since we&#8217;re cool with it for Java), we just found it&#8217;s almost too much trouble with Flex. It never fails to make us want to pull our hair out and say &#8220;Why bother?&#8221; &#8212; Yes, we have used <a href="http://flexmojos.sonatype.org/" target="_blank">FlexMojos</a> and we&#8217;re still not convinced. So we use Ant for Flex builds.</p>
<p>Instead of writing our own Ant build tutorial series for Flex, we&#8217;d like to push you to <a href="http://www.unitedmindset.com/jonbcampos/" target="_blank">Jon Campos</a>&#8217;s tutorials:</p>
<p>January 7th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/07/using-ant-to-build-an-application/" target="_blank">Using ANT to build an Application</a><br />
January 14th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/14/building-a-library-with-ant/" target="_blank">Building a Library with ANT</a><br />
January 19th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/19/building-the-html-wrapper-with-ant/" target="_blank">Building the HTML Wrapper with ANT</a><br />
January 20th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/20/building-a-custom-html-wrapper-with-ant/" target="_blank">Building a Custom HTML Wrapper with ANT</a><br />
January 21st, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/21/including-assets-files-with-ant/" target="_blank">Including Assets Files with ANT</a><br />
January 26th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/26/building-a-library-and-application-with-ant/" target="_blank">Building a Library and Application with ANT</a><br />
January 28th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/01/28/building-asdocs-with-ant/" target="_blank">Building ASDocs with ANT</a><br />
February 2nd, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/02/02/run-flex-unit-tests-from-ant/" target="_blank">Run Flex Unit Tests from ANT</a><br />
February 4th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/02/04/run-flexmonkey-tests-from-ant/" target="_blank">Run FlexMonkey Tests from ANT</a><br />
February 9th, 2010 - <a href="http://www.unitedmindset.com/jonbcampos/2010/02/09/the-master-flex-ant-file/" target="_blank">The Master Flex ANT File</a></p>
<p>Thanks for an awesome series <a href="http://www.unitedmindset.com/jonbcampos/" target="_blank">Jon</a>.</p>
<p>As a side note, if someone can convince me that mvn + flex is better/easier than ant by all means ping me. <a href="mailto:brianr@webappsolution.com">brianr@webappsolution.com</a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Great+Ant+Build+Series+for+Flex+http://xw42o.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Great+Ant+Build+Series+for+Flex+http://xw42o.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2011/02/23/great-ant-build-series-for-flex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting Spark &amp; MX Components to Use Embedded Fonts :: UPDATED**</title>
		<link>http://www.webappsolution.com/wordpress/2011/01/20/getting-spark-mx-components-to-use-embedded-fonts/</link>
		<comments>http://www.webappsolution.com/wordpress/2011/01/20/getting-spark-mx-components-to-use-embedded-fonts/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 20:40:03 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[embedded-fonts]]></category>

		<category><![CDATA[halo]]></category>

		<category><![CDATA[mx]]></category>

		<category><![CDATA[spark]]></category>

		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=956</guid>
		<description><![CDATA[You&#8217;d think embedding a font and declaring it as an Spark Application style would cascade down to all components &#8212; after all, CSS = Cascading Style Sheet, right? Well, it doesn&#8217;t. The font won&#8217;t show up in your MX components. 
After bumping our heads against this about 8-9 months ago we decided to move on&#8230;I [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;d think embedding a font and declaring it as an Spark Application style would cascade down to all components &#8212; after all, CSS = Cascading Style Sheet, right? Well, it doesn&#8217;t. The font won&#8217;t show up in your MX components. </p>
<p>After bumping our heads against this about 8-9 months ago we decided to move on&#8230;I recently had to come back to it and found <a href="http://ria101.wordpress.com/2010/05/27/flex-font-embedding-with-spark-and-halo-made-easy/" target="_blank">this helpful link</a> that allowed me to do the following to get this working as expected.</p>
<p><strong>UPDATE*</strong>: Added style for MX DataGrid.</p>
<pre class="brush: as3;">
@namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
@namespace mx &quot;library://ns.adobe.com/flex/mx&quot;;

@font-face
{
	src: url(&quot;/resources/fonts/Chalkboard.ttc&quot;);
	font-family: ChalkboardEmbedded;
	font-weight: normal;
	font-style: normal;
	embed-as-cff: true;
}

s|Application
{
	font-family: ChalkboardEmbedded;
	font-size: 12;
}

mx|global
{
	textFieldClass: ClassReference(&quot;mx.core.UIFTETextField&quot;);
}

mx|DataGrid
{
	defaultDataGridItemEditor: ClassReference(&quot;mx.controls.MXFTETextInput&quot;);
	defaultDataGridItemRenderer: ClassReference(&quot;mx.controls.dataGridClasses.FTEDataGridItemRenderer&quot;);
}
</pre>
<p><strong>The class-level global style is what does the trick</strong> as it instructs all MX components using text fields to use the UIFTETextField class &#8212; it allows MX or Halo components to leverage CFF embedded fonts.</p>
<p>Run the app with those styles defined and you&#8217;ll notice that one component still doesn&#8217;t want to listen &#8212; the title of the Spark Panel (or at least that&#8217;s the only component I&#8217;ve run across so far that doesn&#8217;t work).</p>
<p>I tried defining the style for the Spark Panel specifically, but no dice. I also tried creating a new skin for the Spark Panel and set the fontFamily property of the titleDisplay to my embedded font of ChalkboardEmbedded and that also failed. Anyone else come up with a solution for this?</p>
<p><strong>UPDATE*</strong>: This approach failed for the following MX classes:</p>
<ul>
<li>ProgressBar</li>
<li>FormHeading</li>
</ul>
<p>This approach failed for the following Spark classes:</p>
<ul>
<li>Panel</li>
</ul>
<p><strong>UPDATE*</strong>:I spoke to several Adobeans on the Flex Doc team and this is unfortunately a known issue:</p>
<blockquote><p>This approach works for most components, but not Panel and a couple others (he identified Panel and ProgressBar in his blog). I suspect he found a bug. This whole thing about using the same embedded font in MX and Spark components was meant to be a temporary solution until Spark had parity with MX controls. A year and a half later, and there&#8217;s still no parity, so there&#8217;s no surprise that users are running into this. </p>
<p>Brian, I would ask him to submit a bug. </p>
<p>He can take a look at the spec: <a href="http://opensource.adobe.com/wiki/display/flexsdk/Font+Embedding+Reprise" target="_blank">http://opensource.adobe.com/wiki/display/flexsdk/Font+Embedding+Reprise</a></p>
<p>That spec seems to indicate that Panel and ProgressBar should work the way it is documented.</p></blockquote>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Getting+Spark+%26+MX+Components+to+Use+Embedded+Fonts+%3A%3A+UPDATED%2A%2A+http://9m394.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Getting+Spark+%26+MX+Components+to+Use+Embedded+Fonts+%3A%3A+UPDATED%2A%2A+http://9m394.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2011/01/20/getting-spark-mx-components-to-use-embedded-fonts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Swiz EventHandler Filtering With Pub/Sub Topics - Part 2</title>
		<link>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics-part-2/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics-part-2/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 21:15:40 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[swiz]]></category>

		<category><![CDATA[eventhandler]]></category>

		<category><![CDATA[metadata]]></category>

		<category><![CDATA[pub-sub-topics]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=946</guid>
		<description><![CDATA[After giving my first pass at this a little thought (which gives all of the details and explains how I got here) I realized the topic value defined in the EventHandler metadata tag was essentially hardcoded and set at compile time &#8212; this can work for some situations, but obviously isn&#8217;t ideal. I then decided [...]]]></description>
			<content:encoded><![CDATA[<p>After giving <a href="http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics/" target="_blank">my first pass</a> at this a little thought (which gives all of the details and explains how I got here) I realized the topic value defined in the EventHandler metadata tag was essentially hardcoded and set at compile time &#8212; this can work for some situations, but obviously isn&#8217;t ideal. I then decided I needed a way to filter events in Swiz by topics with data and values set at runtime. The event dispatching is still the same:</p>
<pre class="brush: as3;">
/**
 * Allows this class to dispatch global events. Only methods using an
 * EventHandler metatadata tag with the property of scope=&quot;global&quot; can
 * handle this event. This means other modules and even the shell application
 * can handle this event if we want.
 *
 * &lt;p&gt;
 * The event dispatcher is injected by Swiz due to the [Dispatcher] metadata
 * and the class member's type of IEventDispatcher.
 * &lt;/p&gt;
 */
[Dispatcher(scope=&quot;global&quot;)]
public var globalDispatcher:IEventDispatcher;
...
public function sayHello():void
{
	logger.debug(&quot;sayHello&quot;);

	var appEvt:AppEvent;

	appEvt = new AppEvent(AppEvent.SAY_HELLO);
	appEvt.hello = &quot;Hello World!&quot;;
    appEvt.topic = &quot;wasiTopic&quot;;
	this.globalDispatcher.dispatchEvent(appEvt);
}
</pre>
<p>But the event handling is setup with a new, additional attribute called topicProperty. </p>
<pre class="brush: as3;">
public var myTopic:String = &quot;wasiTopic&quot;;
...
[EventHandler(event=&quot;AppEvent.SAY_HELLO&quot;, properties=&quot;hello&quot;, scope=&quot;global&quot;, topicProperty=&quot;myTopic&quot;)]
public function helloWithTopic(hello:String):void
{
	logger.debug(&quot;hello = &quot; + hello); // WORKS
}
</pre>
<p>This now allows the developer to set the member variable for the object doing the event handling at runtime. Internally in Swiz&#8217;s <code>org.swizframework.utils.event.EventHandler</code>&#8217;s method <code>public function handleEvent( event:Event ):void</code> we now look for the attribute &#8220;topic&#8221; and &#8220;topicProperty&#8221; in the EventHandler metadata. If the user has set the topicProperty, the method looks at the Bean that&#8217;s using EventHandler and inspects it for this String property and then compares it to the topic passed in the event. This requires some more changes to the Swiz class <code>org.swizframework.utils.event.EventHandler</code>.</p>
<p>Grab the changes I made to Swiz <a href="http://webappsolution.com/flex/blog/examples/swiz-eventhandling-with-topics.zip" target="_blank">here</a>.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Swiz+EventHandler+Filtering+With+Pub%2FSub+Topics+-+Part+2+http://mcawd.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Swiz+EventHandler+Filtering+With+Pub%2FSub+Topics+-+Part+2+http://mcawd.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Swiz EventHandler Filtering With Pub/Sub Topics - Part 1</title>
		<link>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 18:47:22 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[swiz]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[eventhandler]]></category>

		<category><![CDATA[filtering]]></category>

		<category><![CDATA[metatadata]]></category>

		<category><![CDATA[pub-sub-topics]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=930</guid>
		<description><![CDATA[We tend to build many Flex applications with modules, so having the ability to broadcast and listen for messages based on the scope attribute for both Dispatchers and EventHandlers is essential in Swiz. 
UPDATE: Part 2 has Swiz framework code changes and a more robust solution.
If you don&#8217;t know about Swiz Event Scoping, then read [...]]]></description>
			<content:encoded><![CDATA[<p>We tend to build many Flex applications with modules, so having the ability to broadcast and listen for messages based on the <a href="http://swizframework.jira.com/wiki/display/SWIZ/Module+Support" target="_blank">scope attribute for both Dispatchers and EventHandlers is essential in Swiz</a>. </p>
<p>UPDATE: <a href="http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics-part-2/" target="_blank">Part 2</a> has Swiz framework code changes and a more robust solution.</p>
<p>If you don&#8217;t know about Swiz Event Scoping, then read on; otherwise, skip to the section labeled <a href="#topics">Filtering With Topics below</a>.</p>
<p><strong>Background</strong></p>
<p>You can read the actual documentation from Swiz in the last link, but the gist is that you can tell Swiz to either broadcast events on a &#8220;global&#8221; level (using the highest level Application object) or on a &#8220;local&#8221; level (using the Module itself) and then listen to those events in the same fashion. This allows you to tell modules to listen to events only from themselves and not other modules (that might have the same events) or to listen to all events from your main, shell application and/or all other modules. Let&#8217;s look at a quick example by assuming the dispatching code is in LoginViewMediator and the handling code is in LoginController in a Module.</p>
<p><strong>Local Event Dispatching</strong></p>
<p>Local Event Dispatching From LoginViewMediator</p>
<pre class="brush: as3;">
/**
 * Allows this class to dispatch local events. Only methods using an
 * EventHandler metatadata tag with the property of scope=&quot;local&quot; can
 * handle this event.
 *
 * &lt;p&gt;
 * The event dispatcher is injected by Swiz due to the [Dispatcher] metadata
 * and the class member's type of IEventDispatcher.
 * &lt;/p&gt;
 */
[Dispatcher(scope=&quot;local&quot;)]
public var localDispatcher:IEventDispatcher;
...
public function login(userName:String, password:String):void
{
	logger.debug(&quot;login&quot;);

	var appEvt:AppEvent;

	appEvt = new AppEvent(AppEvent.SERVICE_LOGIN);
	appEvt.username = userName;
	appEvt.password = password;
	this.localDispatcher.dispatchEvent(appEvt);
}
</pre>
<p>Local Event Handling in LoginController</p>
<pre class="brush: as3;">
[EventHandler(event=&quot;AppEvent.SERVICE_LOGIN&quot;, properties=&quot;username, password&quot;, scope=&quot;local&quot;)]
public function login(username:String, password:String):void
{
	logger.debug(&quot;login: username = &quot; + username + &quot;, password = &quot; + password);
}
</pre>
<p>If we had other Modules with this same EventHandler statement in their LoginController they would not fire because we specified the scope as local. If we change the scope property to global and the AppEvent is in a common library that all Modules can use, then they would each hear this event and all fire, which in many cases is not what you want. Just so we have a full understanding of what&#8217;s going on, let&#8217;s show an example of broadcasting global events in a similar fashion:</p>
<p><strong>Global Event Dispatching</strong></p>
<p>Global Event Dispatching From ModuleA</p>
<pre class="brush: as3;">
/**
 * Allows this class to dispatch global events. Only methods using an
 * EventHandler metatadata tag with the property of scope=&quot;global&quot; can
 * handle this event. This means other modules and even the shell application
 * can handle this event if we want.
 *
 * &lt;p&gt;
 * The event dispatcher is injected by Swiz due to the [Dispatcher] metadata
 * and the class member's type of IEventDispatcher.
 * &lt;/p&gt;
 */
[Dispatcher(scope=&quot;global&quot;)]
public var globalDispatcher:IEventDispatcher;
...
public function sayHello():void
{
	logger.debug(&quot;sayHello&quot;);

	var appEvt:AppEvent;

	appEvt = new AppEvent(AppEvent.SAY_HELLO);
	appEvt.hello = &quot;Hello World!&quot;;
	this.globalDispatcher.dispatchEvent(appEvt);
}
</pre>
<p>Global Event Handling in Module B</p>
<pre class="brush: as3;">
[EventHandler(event=&quot;AppEvent.SAY_HELLO&quot;, properties=&quot;hello&quot;, scope=&quot;global&quot;)]
public function hello(hello:String):void
{
	logger.debug(&quot;hello = &quot; + hello);
}
</pre>
<p><a name="topics"><strong>Filtering With Topics</strong></a></p>
<p>Again, this is awesome&#8230;but what if you want to broadcast a message that you only want some of the modules to hear? You could obviously put in some simple logic in the event handler that determines if your Module was supposed to listen to the event based on a parameter passed in the EventHandler MetaData, but this could potentially become a large and unwieldy task that you&#8217;ll need to apply to all new modules&#8230;so what if we introduce filtering of Swiz events via a topic attribute in the EventHandler metadata and a corresponding topic property in our dispatched event?</p>
<p>To do this, we&#8217;ll need to do some quick monkey patching to Swiz (by creating the same package structure and adding the same classes we want to change that exist in the Swiz SWC). First, let&#8217;s add the topic property to the <code>org.swizframework.metadata.EventHandlerMetadataTag</code>. Add the topic property:</p>
<pre class="brush: as3;">
protected var _topic:String;
public function get topic():String
{
	return _topic;
}
</pre>
<p>Then add the following to the method <code>override public function copyFrom( metadataTag:IMetadataTag ):void</code></p>
<pre class="brush: as3;">
if( hasArg( &quot;topic&quot; ) )
    _topic = getArg( &quot;topic&quot; ).value;
</pre>
<p>Next we&#8217;ll edit the method <code>public function handleEvent( event:Event ):void</code> in <code>org.swizframework.utils.event.EventHandler</code>. Add the following right after the first if() statement:</p>
<pre class="brush: as3;">
// look for a topic -- if the one exists in the EventHandler MeataData and
// the event does not have one or the value does not equal the EventHandler's
// then we'll filter out this event and not allow it
if(metadataTag.topic != null)
{
	if(event[&quot;topic&quot;] == null)
	{
		return;
	}
	else if(event[&quot;topic&quot;] != metadataTag.topic)
	{
		return;
	}
}
</pre>
<p>That&#8217;s it. Let&#8217;s give it a whirl by using a global dispatcher again, but adding a topic property to the event and a topic attribute to the EventHandler metadata.</p>
<p>Global Event Dispatching From ModuleA</p>
<pre class="brush: as3;">
/**
 * Allows this class to dispatch global events. Only methods using an
 * EventHandler metatadata tag with the property of scope=&quot;global&quot; can
 * handle this event. This means other modules and even the shell application
 * can handle this event if we want.
 *
 * &lt;p&gt;
 * The event dispatcher is injected by Swiz due to the [Dispatcher] metadata
 * and the class member's type of IEventDispatcher.
 * &lt;/p&gt;
 */
[Dispatcher(scope=&quot;global&quot;)]
public var globalDispatcher:IEventDispatcher;
...
public function sayHello():void
{
	logger.debug(&quot;sayHello&quot;);

	var appEvt:AppEvent;

	appEvt = new AppEvent(AppEvent.SAY_HELLO);
	appEvt.hello = &quot;Hello World!&quot;;
        appEvt.topic = &quot;wasiTopic&quot;;
	this.globalDispatcher.dispatchEvent(appEvt);
}
</pre>
<p>Global Event Handling in Module B</p>
<pre class="brush: as3;">
[EventHandler(event=&quot;AppEvent.SAY_HELLO&quot;, properties=&quot;hello&quot;, scope=&quot;global&quot;, topic=&quot;wasiTopic&quot;)]
public function helloWithTopic(hello:String):void
{
	logger.debug(&quot;hello = &quot; + hello); // WORKS
}

[EventHandler(event=&quot;AppEvent.SAY_HELLO&quot;, properties=&quot;hello&quot;, scope=&quot;global&quot;)]
public function helloWithOutTopic(hello:String):void
{
	logger.debug(&quot;hello = &quot; + hello); // NOPE
}

[EventHandler(event=&quot;AppEvent.SAY_HELLO&quot;, properties=&quot;hello&quot;, scope=&quot;global&quot;, topic=&quot;fooTopic&quot;)]
public function helloWithOutTopic(hello:String):void
{
	logger.debug(&quot;hello = &quot; + hello); // NOPE
}
</pre>
<p>UPDATE: <a href="http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics-part-2/" target="_blank">Part 2</a> has Swiz framework code changes and a more robust solution.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Swiz+EventHandler+Filtering+With+Pub%2FSub+Topics+-+Part+1+http://wzsfn.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Swiz+EventHandler+Filtering+With+Pub%2FSub+Topics+-+Part+1+http://wzsfn.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/12/29/swiz-eventhandler-filtering-with-topics/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Some Helpful Settings For Maven Builds</title>
		<link>http://www.webappsolution.com/wordpress/2010/12/20/some-helpful-settings-for-maven-builds/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/12/20/some-helpful-settings-for-maven-builds/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 02:36:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[air]]></category>

		<category><![CDATA[eclipse]]></category>

		<category><![CDATA[flash builder]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[flex builder]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[builder]]></category>

		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=924</guid>
		<description><![CDATA[When running Maven builds, there are typically a few settings that are useful to have in your ~/.bash_profile (for Mac or similar, depending on your shell) to help get things off on the right foot.
Set memory usage to 1024M minimum.
export MAVEN_OPTS=-Xmx1024m
Set the path to the appropriate SDK for Flash Builder
FLASH4_SDK=&#8217;/Applications/Adobe Flash Builder 4 Plug-in/sdks/3.5.0&#8242;
Set the [...]]]></description>
			<content:encoded><![CDATA[<p>When running Maven builds, there are typically a few settings that are useful to have in your ~/.bash_profile (for Mac or similar, depending on your shell) to help get things off on the right foot.</p>
<p>Set memory usage to 1024M minimum.<br />
<em>export MAVEN_OPTS=-Xmx1024m</em></p>
<p>Set the path to the appropriate SDK for Flash Builder<br />
<em>FLASH4_SDK=&#8217;/Applications/Adobe Flash Builder 4 Plug-in/sdks/3.5.0&#8242;</em></p>
<p>Set the path for ADL if building AIR applications<br />
<em>ADL_PATH=${FLASH4_SDK}/bin</em></p>
<p>Set the path to the Flash Player for launching FlexUnit tests<br />
<em>FLASH_PLAYER_PATH=&#8217;/Applications/Adobe Flash Builder 4 Plug-in/Player/mac/Flash Player.app/Contents/MacOS&#8217;</em></p>
<p>Append these to the current path<br />
<em>export PATH=${PATH}:${ADL_PATH}<br />
export PATH=${PATH}:${FLASH_PLAYER_PATH}</em></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Some+Helpful+Settings+For+Maven+Builds+http://58ikg.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Some+Helpful+Settings+For+Maven+Builds+http://58ikg.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/12/20/some-helpful-settings-for-maven-builds/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Substitution Tokens in Resource Bundle Strings in Flex</title>
		<link>http://www.webappsolution.com/wordpress/2010/12/09/substitution-tokens-in-resource-bundle-strings-in-flex/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/12/09/substitution-tokens-in-resource-bundle-strings-in-flex/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 20:04:19 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flex]]></category>

		<category><![CDATA[resource bundle]]></category>

		<category><![CDATA[locale]]></category>

		<category><![CDATA[localization]]></category>

		<category><![CDATA[resource-manager]]></category>

		<category><![CDATA[string]]></category>

		<category><![CDATA[substitution]]></category>

		<category><![CDATA[tokens]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=917</guid>
		<description><![CDATA[There&#8217;s many times where you want to use a Resource Bundle String in-conjunction with variable data. People often breakup the RB String into 2 pieces like so:
part1=My name is
part2=and I like
And then put it back together in AS like:

var part1:String = ResourceManager.getInstance().getString('Labels', 'part1');
var name:String = &#34;Brian Riley&#34;;
var part2:String = ResourceManager.getInstance().getString('Labels', 'part2');
var likes:String = &#34;beer.&#34;;

var myStr:String [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s many times where you want to use a Resource Bundle String in-conjunction with variable data. People often breakup the RB String into 2 pieces like so:</p>
<p>part1=My name is<br />
part2=and I like</p>
<p>And then put it back together in AS like:</p>
<pre class="brush: as3;">
var part1:String = ResourceManager.getInstance().getString('Labels', 'part1');
var name:String = &quot;Brian Riley&quot;;
var part2:String = ResourceManager.getInstance().getString('Labels', 'part2');
var likes:String = &quot;beer.&quot;;

var myStr:String = part1 + &quot; &quot; + name + &quot; &quot; + part2 + &quot; &quot; + likes;
</pre>
<p>Which works, but it&#8217;s a lot of unnecessary code. Take advantage of the tokens allowed in RBs and do the following:</p>
<p>likes=My name is {0} and I like {1}</p>
<pre class="brush: as3;">
var likes:String = ResourceManager.getInstance().getString('Labels', 'likes', [&quot;Brian Riley&quot;, &quot;beer.&quot;]);
</pre>
<p>The ResourceManager class will automatically substitue the tokens {0} and {1} in order and replace them with the array of strings provided as the last param in the getString() method.</p>
<p>Much simpler, right?</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Substitution+Tokens+in+Resource+Bundle+Strings+in+Flex+http://m9idg.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Substitution+Tokens+in+Resource+Bundle+Strings+in+Flex+http://m9idg.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/12/09/substitution-tokens-in-resource-bundle-strings-in-flex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RemoteObject ActionScript &amp; Java Serialization Tips</title>
		<link>http://www.webappsolution.com/wordpress/2010/12/01/remoteobject-actionscript-java-serialization-tips/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/12/01/remoteobject-actionscript-java-serialization-tips/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 13:13:11 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[blazeds]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[remote-object]]></category>

		<category><![CDATA[remoteclass-metadata]]></category>

		<category><![CDATA[serialization]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=891</guid>
		<description><![CDATA[When working with RemoteObjects (ROs) in the Flash Player via a server-side library like BlazeDS, LCDS, or WebORB, there are several simple stumbling blocks that often lead to the case where you receive back untyped, generic ActionScript (AS) Object objects as opposed to the mapping you set up between your AS objects and your Java [...]]]></description>
			<content:encoded><![CDATA[<p>When working with <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html" target="_blank">RemoteObjects</a> (ROs) in the Flash Player via a server-side library like <a href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS" target="_blank">BlazeDS</a>, <a href="http://www.adobe.com/products/livecycle/dataservices/" target="_blank">LCDS</a>, or <a href="http://www.themidnightcoders.com/products.html" target="_blank">WebORB</a>, there are several simple stumbling blocks that often lead to the case where you receive back untyped, generic ActionScript (AS) Object objects as opposed to the mapping you set up between your AS objects and your Java objects. I&#8217;ll note the most common issues quickly and move on to provide additional explanation where necessary.</p>
<p><strong>Common Issues</strong></p>
<ul>
<li>Incorrect spelling / mapping of Java class in RemoteClass metadata in AS object: <em>[RemoteClass(alias="fullyQualifiedJavaClass")]</em></li>
<li>Incorrect spelling / capitalization of properties.</li>
<li>Not providing empty constructors in Java object.</li>
<li>Not using formal getter / setters methods for properties in Java object.</li>
<li>AS mapped object not compiled into the SWF. This happens when using ArrayCollections and the item isn&#8217;t referenced anywhere in the application and thus not compiled into the SWF.</li>
</ul>
<p><strong>Nonexistent or Incorrect ActionScript Mapping</strong><br />
In order to tell the Flash Player to serialize your Java <a href="http://martinfowler.com/eaaCatalog/dataTransferObject.html" target="_blank">Data Transfer Objects</a> (DTOs) to your explicit AS objects you&#8217;ll need to make sure you include the all important [RemoteClass(alias="fully qualified Java class we're mapping to")] metadata.</p>
<p>The most common culprit here is usually a simple misspelling of the fully qualified Java object in your RemoteClass metadata, but here&#8217;s a list of other common things to note before we look at an example:</p>
<p><strong>REQUIRED:</strong></p>
<ul>
<li>You must include the metadata <em>[RemoteClass(alias="fullyQualifiedJavaClass")]</em>. Make sure the name of Java object is the fully qualified name.</li>
<li>The properties you want to map must be public.</li>
<li>The properties you want to map must be spelled and capitalized exactly the same as they appear in your Java class.</li>
<li>If your Java object extends another object and you want the properties in the super class also mapped to your AS object, you must either a) create that class in AS and map it to the base Java object or b) add those properties directly into your AS object.</li>
<li>If your AS object contains complex objects that exist in the Java side and you want that object mapped correctly you&#8217;ll need to create that class in AS and map its corresponding Java object.</li>
<li>If your AS object contains an Array or ArrayCollection that will be populated with objects you expect to be mapped, you&#8217;ll need to a) ensure the corresponding AS object is mapped and b) is compiled into the application. A simple trick to ensure that your AS object is compiled into the app is to declare ArrayCollections like so: <em>public var foos:ArrayCollection = new ArrayCollection();Foo;</em> This also helps you and other developers see what kind of AS object is expected in the list like a Java generic. The compiler and player obviously won&#8217;t throw errors or complain if the objects aren&#8217;t of that type, but from a readability perspective it&#8217;s quite helpful.</li>
</ul>
<p><strong>OPTIONAL/MISNOMER</strong></p>
<ul>
<li>You can specify your public properties as either regular, old public properties or using the getter and setter functions.</li>
<li>The package of your AS object does not need to match the package of your Java object. The aforementioned RemoteClass metadata takes care of that for you.</li>
<li>You do not need a constructor in your AS object.</li>
<li>You can have extra, non-mapped properties in your AS object.</li>
<li>You do not need to implement the same interface as your Java object. In fact, you can use additional, client-side only interfaces to extend your AS object and it will not effect the mapping.</li>
<li>You do not need to annotate the class with the [Bindable] metadata. It&#8217;s often the case where it is because you&#8217;re using the object as a doman/model/vo on the client and want other things to bind to it, but it&#8217;s not required.</li>
<li>You can have methods in your AS obj that do not map to methods in your Java object.</li>
</ul>
<pre class="brush: as3;">
package com.webappsolution.myapp.model
{
	[RemoteClass(alias=&quot;com.webappsolution.myapp.dto.PersonDTO&quot;)]
	public class PersonModel extends FooModel implements IUniqueItem
	{
		public function PersonModel()
		{
			super();
		}

		// mapping using getter ans setter functions for public properties
		// also implements IUniqueItem interface
		private var _id:String;
		public function get id():String
		{
			return _id;
		}
		public function set id(value:String):void
		{
			_id = value;
		}

		public var age:int = 0;
		public var firstName:String = &quot;&quot;;
		public var lastName:String = &quot;&quot;;
		public var birthDate:Date = new Date();
		public var isBeerDrinker:Boolean = true;
		public var complexObject:ComplexObject = new ComplexObject();

		// put in the references to the types of items we exopect in the collection
		// to ensure that they are compiled into the swf. this also provides a
		// nice readability clue as well to other developers.
		public var foos:ArrayCollection = new ArrayCollection();Foo;

		// not mapped
		public var isDisabled:Boolean;
		protected var uid:int;

		// not mapped
		public function getFullName():String
		{
			return this.firstName + &quot; &quot; + this.lastName;
		}

	}
}
</pre>
<p><strong>Java Object Issues</strong><br />
There&#8217;s a couple quick gotchas here that should be noted when creating Java objects that you wish to map to AS objects, as many of the important issues are covered above in the AS section &#8212; I&#8217;ll list these quickly followed by a small example.</p>
<p><strong>REQUIRED:</strong></p>
<ul>
<li>You must provide an empty constructor.</li>
<li>You must use formal getters and setters for your properties. You cannot just list out public properties in Java like we do in AS.</li>
</ul>
<p><strong>OPTIONAL:</strong></p>
<ul>
<li>While an empty constructor is required, it&#8217;s ok to override it and provide multiple constructors as well.</li>
<li>You can have extra, non-mapped properties in your Java object.</li>
<li>You can implement interfaces in your Java object that do not exist in your AS object.</li>
<li>Considering using the <a href="http://martinfowler.com/eaaCatalog/dataTransferObject.html" target="_blank">DTO pattern</a> on the Java side to pass objects across the wire as opposed to allowing AS objects to map to domain/entity objects in your Java tier. This can be especially important when using domain/entity objects that are mapped to a database via Hibernate &#8212; there are lazy loading issues here that can cause less than fully populated object graphs to come across the wire to your Flex app. Instead, put a service layer in front of your domain object layer that returns DTOs.</li>
</ul>
<pre class="brush: java;">
package com.webappsolution.myapp.dto;

import ...

public class PersonDTO implements IStuff
{
	private String id;
	private int age;
	private String firstName;
	private String lastName;
	private Date birthDate;
	private boolean isBeerDrinker;
	private ComplexObject complexObject;

	public PersonDTO()
	{
	}
	public PersonDTO(String fName, String lName)
	{
		this.firstName = fName;
		this.lastName = lName;
	}
	public PersonDTO(String fName, String lName, int age)
	{
		this.firstName = fName;
		this.lastName = lName;
		this.age = age;
	}

	public long getId()
	{
		return id;
	}

	public void setId(long id)
	{
		this.id = id;
	}

	public String getFirstName()
	{
		return firstName;
	}

	public void setFirstName(String firstName)
	{
		this.firstName = firstName;
	}

	public String getLastName()
	{
		return lastName;
	}

	public void setLastName(String lastName)
	{
		this.lastName = lastName;
	}

	// omitting the rest of the public getters / setters for brevity, but you'd
	// need one for each property you want to map
}
</pre>
<p>For more information on RemoteObjects, please visit the Adobe Flex documentation:<a href="http://help.adobe.com/en_US/Flex/4.0/AccessingData/WS2db454920e96a9e51e63e3d11c0bf69084-7fda.html" target="_blank"> Using RemoteObject components </a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=RemoteObject+ActionScript+%26+Java+Serialization+Tips+http://zyfgo.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=RemoteObject+ActionScript+%26+Java+Serialization+Tips+http://zyfgo.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/12/01/remoteobject-actionscript-java-serialization-tips/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WASI @ MAX!</title>
		<link>http://www.webappsolution.com/wordpress/2010/10/22/wasi-max/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/10/22/wasi-max/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 16:43:43 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[adobe-max]]></category>

		<category><![CDATA[contact]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=888</guid>
		<description><![CDATA[Hit us up at MAX!
Brian Riley
617-480-0432
brianr@webappsolution.com
AIM/GIM/MSN/YIM/Twitter/Skype: wasibrianr
Tim McGee
508-566-6711
tim@webappsolution.com
AIM/GIM/YIM/MSN cheftimbob
Skype wasitim
Joe Seiter
201.981.2347
joes@webappsolution.com
YIM: seiter
AIM/GIM/Skype: wasijoes
 Tweet This Post]]></description>
			<content:encoded><![CDATA[<p>Hit us up at MAX!</p>
<p><strong>Brian Riley</strong><br />
617-480-0432<br />
brianr@webappsolution.com<br />
AIM/GIM/MSN/YIM/Twitter/Skype: wasibrianr</p>
<p><strong>Tim McGee</strong><br />
508-566-6711<br />
tim@webappsolution.com<br />
AIM/GIM/YIM/MSN cheftimbob<br />
Skype wasitim</p>
<p><strong>Joe Seiter</strong><br />
201.981.2347<br />
joes@webappsolution.com<br />
YIM: seiter<br />
AIM/GIM/Skype: wasijoes</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=WASI+%40+MAX%21+http://wwmna.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=WASI+%40+MAX%21+http://wwmna.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/10/22/wasi-max/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Software List For New MacBook Pro Laptop</title>
		<link>http://www.webappsolution.com/wordpress/2010/10/14/software-list-for-new-macbook-pro-laptop/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/10/14/software-list-for-new-macbook-pro-laptop/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 21:43:14 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[mac]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[development]]></category>

		<category><![CDATA[getting-started]]></category>

		<category><![CDATA[laptop]]></category>

		<category><![CDATA[macbook-pro]]></category>

		<category><![CDATA[new-laptop]]></category>

		<category><![CDATA[productivity]]></category>

		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=871</guid>
		<description><![CDATA[My partner and I just received our new MBPs and we&#8217;re pretty pumped about them &#8212; 17in, 8GB Ram, stateless HDs &#8212; very speedy. Startup is like 3 seconds, and I&#8217;m not kidding. 
As we all know, getting a new computer is awesome, but it&#8217;s also a double edged sword&#8230;as my other partner Joe noted: [...]]]></description>
			<content:encoded><![CDATA[<p>My partner and I just received our new MBPs and we&#8217;re pretty pumped about them &#8212; 17in, 8GB Ram, stateless HDs &#8212; very speedy. Startup is like 3 seconds, and I&#8217;m not kidding. </p>
<p>As we all know, getting a new computer is awesome, but it&#8217;s also a double edged sword&#8230;as my other partner Joe noted: &#8220;The worst thing about getting a new laptop is&#8230;well&#8230;getting a <em>new</em> laptop.&#8221; Sure the thing flies and all, but man there&#8217;s a good amount of hrs getting it ready for primetime development&#8230;think of all the little tools you&#8217;ve collected to make your laptop rock&#8230;</p>
<p>My partner and I have started to compile a live list of dev tools, goodies, IDEs,and  whatevs we use on a regular basis and we thought we&#8217;d share &#8212; if you have others, please add to this list:</p>
<p><strong>Basic Software &#038; IDEs</strong></p>
<ul>
<li><a href="http://eclipse.org/downloads/packages/release/galileo/r" target="blank">Eclipse Galileo R Packages</a> or more specifically we use the  <a href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-jee-galileo-macosx-carbon.tar.gz" target="blank">Eclipse J2EE IDE</a></li>
<li><a href="http://www.adobe.com/products/flashbuilder/" target="blank">Flash Builder</a> &#8212; usually plug this into Eclipse</li>
<li><a href="http://www.adobe.com/products/fireworks/" target="blank">Fireworks</a></li>
<li><a href="http://www.adobe.com/products/flash/" target="blank">Flash</a></li>
<li><a href="http://www.balsamiq.com/products/mockups/" target="blank">Balsamiq</a></li>
<li><a href="http://www.microsoft.com/mac/default.mspx" target="blank">MS Office</a></li>
</ul>
<p><strong>Connectivity &#038; Tools</strong></p>
<ul>
<li><a href="http://www.microsoft.com/mac/products/remote-desktop/default.mspx" target="blank">Remote Desktop Connection Client for Mac 2</a></li>
<li><a href="http://sourceforge.net/projects/cotvnc/" target="blank">Chicken of the VNC</a></li>
<li><a href="http://ftp.uma.es/ClientesVPN/" target="blank">Cisco VPN Client</a></li>
<li><a href="http://dev.mysql.com/downloads/workbench/5.2.html" target="blank">MySQL Workbench</a></li>
<li><a href="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html" target="blank">Oracle SQL Developer</a></li>
<li>Maven</li>
</ul>
<p><strong>IM &#038; Social</strong></p>
<ul>
<li><a href="http://adium.im/" target="blank">Adium</a></li>
<li><a href="http://www.skype.com/intl/en-us/get-skype/on-your-computer/macosx/" target="blank">Skype</a></li>
<li><a href="http://www.tweetdeck.com/desktop/" target="blank">TweetDeck</a></li>
</ul>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Software+List+For+New+MacBook+Pro+Laptop+http://45r84.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Software+List+For+New+MacBook+Pro+Laptop+http://45r84.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/10/14/software-list-for-new-macbook-pro-laptop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mac Flash Builder Plugin Install Error 6 + FIX</title>
		<link>http://www.webappsolution.com/wordpress/2010/10/08/mac-flash-builder-plugin-install-error-6-fix/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/10/08/mac-flash-builder-plugin-install-error-6-fix/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 15:45:50 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[eclipse]]></category>

		<category><![CDATA[flash builder]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[fix]]></category>

		<category><![CDATA[install]]></category>

		<category><![CDATA[issue]]></category>

		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=861</guid>
		<description><![CDATA[I just received my new 17in MBP so I pulled down a new version of Eclipse&#8217;s J2EE IDE and installed Flash Builder Plugin. 
NOTE: You need to use the Eclipse Galileo Packages and the Carbon Install in order for this to work since FB is not compatible with the latets Eclipse build called Helio &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>I just received my new 17in MBP so I pulled down a new version of Eclipse&#8217;s J2EE IDE and installed Flash Builder Plugin. </p>
<p><strong>NOTE</strong>: You need to use the <a href="http://eclipse.org/downloads/packages/release/galileo/r" target="_blank">Eclipse Galileo Packages and the Carbon</a> Install in order for this to work since FB is not compatible with the latets Eclipse build called Helio &#8212; <a href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-jee-galileo-macosx-carbon.tar.gz" target="_blank">here&#8217;s a link to the exact version of Eclipse that I used</a>.</p>
<p>After a seemingly successful installation I received the following error code when starting up Eclipse: Error 6. I googled around a bit and found this <a href="http://forums.adobe.com/thread/716299?tstart=0">link</a> with this important tid-bit that fixed my issue:</p>
<ul>
<li>Reboot your Mac</li>
<li><font color="#336633"><strong>Navigate to your installation folder under /Adobe Flash Builder 4 Plug-in/install.support/AdobeFlashBuilderPluginSTIWrapperMac/</strong></font></li>
<li><font color="#336633"><strong>Run Install.app from that location, to make sure all the required runtimes are installed successfully.</strong></font></li>
</ul>
<p>The restart seemed to do nothing, but running the installer did the trick. Good luck!</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Mac+Flash+Builder+Plugin+Install+Error+6+%2B+FIX+http://bk96t.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Mac+Flash+Builder+Plugin+Install+Error+6+%2B+FIX+http://bk96t.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/10/08/mac-flash-builder-plugin-install-error-6-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Builder Network Monitor Project Property Causes HTTP Security Error</title>
		<link>http://www.webappsolution.com/wordpress/2010/10/06/flash-builder-network-monitor-project-property-causes-http-security-error/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/10/06/flash-builder-network-monitor-project-property-causes-http-security-error/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 21:57:34 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[flash builder]]></category>

		<category><![CDATA[bug]]></category>

		<category><![CDATA[fail]]></category>

		<category><![CDATA[issue]]></category>

		<category><![CDATA[network-monitor]]></category>

		<category><![CDATA[pissed-off]]></category>

		<category><![CDATA[screwed]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=848</guid>
		<description><![CDATA[This sucker literally sucked up waaaay too many man hrs between my partner and myself trying to debug this issues, so I hope it saves someone else &#8212; for the short read, if you&#8217;ve used the Network Monitor in Flash Builder in a project make sure you open up .actionScriptProperties and set the property includeNetmonSwc [...]]]></description>
			<content:encoded><![CDATA[<p>This sucker literally sucked up waaaay too many man hrs between my partner and myself trying to debug this issues, so I hope it saves someone else &#8212; for the short read, if you&#8217;ve used the Network Monitor in Flash Builder in a project make sure you open up .actionScriptProperties and set the property <strong><em>includeNetmonSwc</em></strong> = false.</p>
<p>includeNetmonSwc=&#8221;false&#8221;</p>
<p>For more of an explanation read the following &#8212; here&#8217;s the scenario:</p>
<p>We created an app that loads services.xml from within the same Java container as our SWF, so there&#8217;s no need for a crossdomain.xml file. The xml file was relative to the SWF and the HTML container for the SWF as such:</p>
<p>* main.html<br />
* main.swf<br />
    * assets/service-locator/services.xml</p>
<p>In our local dev environments we have a Flex app that publishes itself to a Java app on Tomcat running in Eclipse with BlazeDS + Spring + Hibernate. Running locally, everything worked fine. When we deployed the WAR to a client&#8217;s remote Tomcat instance logged in via their VPN, my partner and I were able to hit the app and the XML file loaded fine. When the client tried, it failed and they received the following HTTPService Fault:</p>
<ul>
<li>faultCode = Channel.Security.Error</li>
<li>faultDetail = Destination: DefaultHTTP</li>
<li>faultString = Security error accessing url</li>
</ul>
<p>This honestly baffled us for some time&#8230;why could we hit get the SWF to load the XML file when VPN&#8217;d in while the client received an error on their own network? After trying every security thing under the sun with the Flash Player, we simply created a new Flex project, put in a simple XML load via an HTTPService, and deployed it to the same WAR (as above with BlazeDS + Spring + Hibernate) and it worked for both us and them. Then we put the exact same Flex code from our original app into the test Flex app and again it worked for both us and out client&#8230;huh?</p>
<p>While it did work and we could just move on and fist pump the day away with out newfound success, we were obviously worried that something greater was at play and might come back to bite us in the ass. At this point we knew it was client code and not server code, so we decided to check the build properties and compiler options, etc, but it was all the same.</p>
<p>Finally we decided to do a compare on the project property files from the original project and the new one starting with .actionScriptProperties &#8212; and there it was, a simple flag difference of the property:</p>
<p>includeNetmonSwc=&#8221;true&#8221;</p>
<p>&#8230;and WHAM, it smacked me in the face. </p>
<p>Waaaaay back when we started this project I decided to play with the new <a href="http://cookbooks.adobe.com/post_Flash_Builder_4_Network_Monitor_sample_application-17182.html" target="_blank">Network Monitor</a> (NM) integrated into Flash Builder. I used it maybe for 30 mins and said, ok, great&#8230;next. Well, this little flag apparently creates some settings (maybe opens ports or something) on dev machines that allows the NM to work like an HTTP Proxy/Sniffer similar to Charles or ServiceCapture&#8230;when this SWF is deployed to a server where these settings haven&#8217;t been set&#8230;well&#8230;you&#8217;re efffed. No dice. And you get the security error mentioned above.</p>
<p>Bottom line, make sure you either set the value to false:</p>
<p>includeNetmonSwc=&#8221;false&#8221;</p>
<p>or remove this sucker entirely. I really hope that helps someone as it cost us a ton of time. Thank you Adobe.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Flash+Builder+Network+Monitor+Project+Property+Causes+HTTP+Security+Error+http://pq2y6.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Flash+Builder+Network+Monitor+Project+Property+Causes+HTTP+Security+Error+http://pq2y6.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/10/06/flash-builder-network-monitor-project-property-causes-http-security-error/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex &amp; ActionScript Regex List</title>
		<link>http://www.webappsolution.com/wordpress/2010/09/01/actionscript-regex-list/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/09/01/actionscript-regex-list/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 12:53:11 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[regex]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=840</guid>
		<description><![CDATA[I&#8217;m not great with regex since I don&#8217;t use it a ton so I constantly find myself looking up simple, reusable regex statements&#8230;thought I&#8217;d just start listing them as I use them in case someone else finds them useful. This will start with just a couple examples that we&#8217;ll continue to add to.
Assume the following [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not great with regex since I don&#8217;t use it a ton so I constantly find myself looking up simple, reusable regex statements&#8230;thought I&#8217;d just start listing them as I use them in case someone else finds them useful. This will start with just a couple examples that we&#8217;ll continue to add to.</p>
<p>Assume the following vars:</p>
<pre class="brush: as3;">
var myString:String;
var pattern:RegExp;
var resultString:String;
var isSuccess:Boolean;
</pre>
<p><strong>Remove All Spaces</strong></p>
<pre class="brush: as3;">
myString = &quot;The quick brown fox.&quot;;
pattern = /\s+/g;
resultString = myString.replace(pattern, &quot;&quot;);
trace(resultString); // Thequickbrownfox.
</pre>
<p><strong>Remove Special Characters &#038; Spaces</strong></p>
<pre class="brush: as3;">
myString = &quot;The 123 quick 456 brown !@#$% fox.&quot;;
pattern = /\W/g;
resultString = myString.replace(pattern, &quot;&quot;);
trace(resultString); // The123quick456brownfox
</pre>
<p><strong>Remove Special Characters &#038; Numbers &#038; Spaces</strong></p>
<pre class="brush: as3;">
myString = &quot;The 123 quick 456 brown !@#$% fox.&quot;;
pattern = /[^a-zA-Z]+/g;
resultString = myString.replace(pattern, &quot;&quot;);
trace(resultString); // Thequickbrownfox
</pre>
<p><strong>Test URL String</strong></p>
<pre class="brush: as3;">
myString = &quot;http://yahoo.com&quot;;
pattern = /^http(s)?:\/\/((\d+\.\d+\.\d+\.\d+)|(([\w-]+\.)+([a-z,A-Z][\w-]*)))(:[1-9][0-9]*)?(\/([\w-.\/:%+@&amp;=]+[\w- .\/?:%+@&amp;=]*)?)?(#(.*))?$/i;
isSuccess = pattern.test(myString);
trace(isSuccess); // true
myString = &quot;htt://yahoo.com&quot;;
isSuccess = pattern.test(myString);
trace(isSuccess); // false
</pre>
<p><strong>Trim String (With Tabs &#038; Returns): Courtesy of <a href="http://jeffchannell.com/ActionScript-3/as3-trim.html" target="_blank">Jeff Channel</a></strong></p>
<pre class="brush: as3;">
myString = myString = &quot;The quick brown fox.                   		&quot;;
pattern = /^\s+|\s+$/gs;
resultString = myString.replace(pattern, &quot;&quot;);
trace(resultString); // &quot;The quick brown fox.&quot;
</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Flex+%26+ActionScript+Regex+List+http://ciya4.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.webappsolution.com/wordpress/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Flex+%26+ActionScript+Regex+List+http://ciya4.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/09/01/actionscript-regex-list/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

