<?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 &#187; actionscript</title>
	<atom:link href="http://www.webappsolution.com/wordpress/category/actionscript/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, 05 Apr 2012 19:39:33 +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>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>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>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>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>
		<item>
		<title>Unable to export SWC oem</title>
		<link>http://www.webappsolution.com/wordpress/2010/04/07/unable-to-export-swc-oem/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/04/07/unable-to-export-swc-oem/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 19:35:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

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

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=763</guid>
		<description><![CDATA[Been switching environments a bit lately from Flash Builder to Flex Builder and back and using different SDKs.
When importing a new project that someone had checked in from a different version, the .flexLibProperties file was causing this issue.
After much scouring, I found something that worked.
Open .flexLibProperties and find the section &#60;includeResource/&#62;. Remove everything in that [...]]]></description>
			<content:encoded><![CDATA[<p>Been switching environments a bit lately from Flash Builder to Flex Builder and back and using different SDKs.</p>
<p>When importing a new project that someone had checked in from a different version, the .flexLibProperties file was causing this issue.</p>
<p>After much scouring, I found something that worked.</p>
<p>Open .flexLibProperties and find the section &lt;includeResource/&gt;. Remove everything in that section.</p>
<p>Made the problem disappear.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Unable+to+export+SWC+oem+http://9x7if.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=Unable+to+export+SWC+oem+http://9x7if.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/04/07/unable-to-export-swc-oem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamic Classes Gotcha!</title>
		<link>http://www.webappsolution.com/wordpress/2010/04/06/dynamic-classes-gotcha/</link>
		<comments>http://www.webappsolution.com/wordpress/2010/04/06/dynamic-classes-gotcha/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 19:30:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=758</guid>
		<description><![CDATA[We recently started using dynamic classes to assist with unknown data formats. It&#8217;s a pretty powerful feature of the language. It comes with a price in that you don&#8217;t get strong typing nor intellisense on the dynamic properties. But, there are cases where it can serve great purpose.
One of the things you have to keep [...]]]></description>
			<content:encoded><![CDATA[<p>We recently started using dynamic classes to assist with unknown data formats. It&#8217;s a pretty powerful feature of the language. It comes with a price in that you don&#8217;t get strong typing nor intellisense on the dynamic properties. But, there are cases where it can serve great purpose.</p>
<p>One of the things you have to keep in mind though is that since the class is dynamic, the compiler can&#8217;t provide the linkage for you to do something like:</p>
<pre class="brush: as3;">
var someValue:SomeClass = someObject as SomeDynamicClass;
</pre>
<p>The compiler won&#8217;t complain, but, you will as you scratch your head trying to understand why someValue == null all the time. The lack of information at compile time is the obvious culprit.</p>
<p>But, I have found a decent workaround. Provide a constructor for the dynamic class that takes and Object as an optional parameter. If you pass in a parameter, call the helper function to populate the object. Here I&#8217;m using a form of reflection to do this dynamically so I don&#8217;t have to hand write all the properties.</p>
<pre class="brush: as3;">

dynamic public class SomeDynamicClass

public function SomeDynamicClass(obj:Object=null)
{
if ( obj )
this.populateMe(obj);
}

private function populateMe(source:Object):void
{

var destinationList:XML = describeType(this);

for each ( var propName:XML in destinationList..variable )
{
if ( source.hasOwnProperty( propName.@name ) )
{
var cls:Class = getDefinitionByName(propName.@type) as Class;
this[propName.@name] = source[propName.@name] as cls;
}
}
}
</pre>
<p>Later on, when you get some generic Object, like from ArrayCollection.getItem, you don&#8217;t do the normal cast but instead create a new instance passing in the Object.</p>
<pre class="brush: as3;">
var someValue:SomeClass = new SomeDynamicClass(someObject);
</pre>
<p>Hope that helps.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Dynamic+Classes+Gotcha%21+http://ydh2r.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=Dynamic+Classes+Gotcha%21+http://ydh2r.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2010/04/06/dynamic-classes-gotcha/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dude, Where’s My Chart Labels?</title>
		<link>http://www.webappsolution.com/wordpress/2009/11/19/dude-where%e2%80%99s-my-chart-labels/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/11/19/dude-where%e2%80%99s-my-chart-labels/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:43:52 +0000</pubDate>
		<dc:creator>joes</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[data visualization]]></category>

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=669</guid>
		<description><![CDATA[ 
Wondering where your Flex Chart labels are?  Well, you’re not alone. Turns out it may be related to your use of Embedded Fonts and Modules. 

Surfacing a charting component in a Module works just fine when not making use of Embedded Fonts. Embed fonts in your main application or the Module itself and [...]]]></description>
			<content:encoded><![CDATA[<p><!--[endif]--> <!--StartFragment--></p>
<p class="MsoNormal">Wondering where your Flex Chart labels are? <span> </span>Well, you’re not alone.<span> </span>Turns out it may be related to your use of Embedded Fonts and Modules.<span> </span></p>
<p class="MsoNormal">
<p class="MsoNormal">Surfacing a charting component in a Module works just fine when not making use of Embedded Fonts.<span> </span>Embed fonts in your main application or the Module itself and Presto! <span> </span>Your labels will disappear.</p>
<p class="MsoNormal">
<p class="MsoNormal">A number of bug tickets have been opened and closed with Adobe, i.e. <a href="http://bugs.adobe.com/jira/browse/FLEXDMV-1883">http://bugs.adobe.com/jira/browse/FLEXDMV-1883</a>, indicating that the issue was resolved with DMV 3.3.0.<span> </span>Currently using DMV 3.4.0.9271, however, and the problem seems to have re-emerged.<span> </span></p>
<p class="MsoNormal">
<p class="MsoNormal">Opening another bug ticket with Adobe and in the meantime commenting out the use of Embedded Fonts.</p>
<p class="MsoNormal">
<p class="MsoNormal">More to follow…<span> </span></p>
<p><!--EndFragment--></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Dude%2C+Where%E2%80%99s+My+Chart+Labels%3F+http://arbpb.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=Dude%2C+Where%E2%80%99s+My+Chart+Labels%3F+http://arbpb.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/11/19/dude-where%e2%80%99s-my-chart-labels/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Axiis Drill Down Example</title>
		<link>http://www.webappsolution.com/wordpress/2009/11/02/axiis-drill-down-example/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/11/02/axiis-drill-down-example/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:25:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

		<category><![CDATA[data visualization]]></category>

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=572</guid>
		<description><![CDATA[I&#8217;ve seen a number of requests for a drill down version of an Axiis chart. We have a current client that will need that functionality as well so I figured I&#8217;d give it a shot.
The approach I&#8217;m taking is pretty straight forward. Put a drill down layout on the stage and make it invisible initially. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a number of requests for a drill down version of an Axiis chart. We have a current client that will need that functionality as well so I figured I&#8217;d give it a shot.</p>
<p>The approach I&#8217;m taking is pretty straight forward. Put a drill down layout on the stage and make it invisible initially. When the user clicks on an item in the primary chart that we want to drill in, capture the event, set a dataProvider specific to the portion of the data that represents the drill down, hide the primary layout and show the drill down layout.</p>
<p>Building off the familiar approach for the Axiis examples, add a few objects for the drill down layout to use</p>
<pre class="brush: as3;">
&lt;mx:Object id=“dataProvider”/&gt;
&lt;mx:String id=“verticalField”/&gt;
&lt;mx:String id=“dataField”&gt;date&lt;/mx:String&gt;
&lt;mx:String id=“labelField”&gt;date.value&lt;/mx:String&gt;
&lt;mx:Object id=“drilldataProvider”/&gt;
&lt;mx:String id=“drilldataField”/&gt;
&lt;mx:String id=“drilllabelField”/&gt;
</pre>
<p>The drill down layout can be whatever type you choose. Here I&#8217;m just going to display the data as a simple bar chart.</p>
<pre class="brush: as3;">
&lt;axiis:HBoxLayout
      id=“drillDownLayout”
      x=“25”
      y=“0”
      showDataTips=“true”
      height=“{dc.height-70}”
      width=“{dc.width-25}”
      visible=“false”
      dataProvider=“{drilldataProvider}”
      percentGap=“0”
      dataField=“{drilldataField}”
      labelField=“{drilllabelField}”
      itemClick=“this.itemClick(event);”&gt;

    &lt;axiis:drawingGeometries&gt;
       &lt;degrafa:RegularRectangle
             id=“drillRectangle”
             x=“{drillDownLayout.currentReference.x}”
             y=“{drillDownLayout.height-vScale.valueToLayout(drillDownLayout.currentValue)}”
             width=“{drillDownLayout.currentReference.width}”
             height=“{vScale.valueToLayout(drillDownLayout.currentValue)}”
             stroke=“{colStroke}”/&gt;

       &lt;degrafa:RasterText
             text=“{drillDownLayout.currentLabel}”
             fontFamily=“Arial”
             align=“center”
             x=“{drillDownLayout.currentReference.x}”
             width=“{drillDownLayout.currentReference.width}”
             y=“{drillDownLayout.height+5}”/&gt;
     &lt;/axiis:drawingGeometries&gt;
&lt;/axiis:HBoxLayout&gt;
</pre>
<p>The only real piece of interest in this is the addition of a handler for the itemClick event.</p>
<pre class="brush: as3;">
itemClick=&quot;this.itemClick(event)&quot;
</pre>
<p>Here&#8217;s the code that will handle the click of an item in the layout. Note that it will check to see which layout is currently visible so we can get back to the primary chart.</p>
<pre class="brush: as3;">
public function itemClick(evt:LayoutItemEvent):void
{
       // Switch back to main view
       if ( this.drillDownLayout.visible )
       {
            this.drilldataProvider = null;
            this.drillDownLayout.visible = false;
            this.hLayout.visible = true;
            dc.invalidateDisplayList();
         }else {
             var ac:ArrayCollection = evt.item.layout.dataProvider as ArrayCollection;
             this.hLayout.visible = false;
             this.drillDownLayout.visible = true;
             this.drilldataField = &amp;amp;quot;value&amp;amp;quot;;
             this.drilllabelField = &amp;amp;quot;value&amp;amp;quot;;
             this.drillRectangle.fill = ( evt.item.data.type == &quot;receivables&quot; ) ? this.receivablesStack.fill : this.payablesStack.fill;
             this.drilldataProvider = ac;
             dc.invalidateDisplayList();
        }
}
</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Axiis+Drill+Down+Example+http://dzk4m.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=Axiis+Drill+Down+Example+http://dzk4m.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/11/02/axiis-drill-down-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Axiis Examples with Lots of Comments</title>
		<link>http://www.webappsolution.com/wordpress/2009/10/17/axiis-examples-with-lots-of-comments/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/10/17/axiis-examples-with-lots-of-comments/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 09:32:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

		<category><![CDATA[data visualization]]></category>

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

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=561</guid>
		<description><![CDATA[We&#8217;ve begun using Axiis on a current client&#8217;s project. The application is loaded with graphs and charts and when we hand off the project, we needed to provide a framework for the development staff to quickly build and add new graphing components. Some of the charts are simple but there are some more complicated ones [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve begun using <a href="http://www.axiis.org/index.html">Axiis</a> on a current client&#8217;s project. The application is loaded with graphs and charts and when we hand off the project, we needed to provide a framework for the development staff to quickly build and add new graphing components. Some of the charts are simple but there are some more complicated ones we need to build and will be built in the future. The current Flex DataViz components work fine for simple tasks. But, anyone who has had to go beyond the basics understands the pain that you quickly begin to feel.</p>
<p>Fortunately, I caught <a href="http://www.twgonzalez.com/blog/">Tom Gonzalez&#8217;s</a>, (<a href="http://www.brightpointinc.com/">BrightPoint Consulting)</a> lecture at MAX this month and was blown away. The things they&#8217;re doing with the Axiis framework and <a>Degrafa</a> are off the charts! (pun intended)</p>
<p>I&#8217;ll leave the real discovery to you to check out the Axiis site, but, Axiis is a &#8217;specialized framework that implements specific design patterns that can be used to create your own visualizations&#8217;. It&#8217;s not a pre-built collection of charting components. They&#8217;ve developed a great way of abstracting the basic building blocks of doing data visualization.</p>
<p>Axiis is currently in beta release. There are a lot of great examples on their site so check them out. If you&#8217;re new to Degrafa, it&#8217;s worth your while to do a bit of reading and check out the cool examples they have on their site as well since many of the examples use Degrafa.</p>
<p>Being in beta, the documentation is a work in progress. The examples from the site are great and really cover a lot of space, but I did struggle with some of the concepts at first. So I&#8217;ve taken three of the first examples we needed to borrow from and hyper-commented them for clarity.<br />
I&#8217;ll continue to add to the collection over time.</p>
<p><a href="http://www.webappsolution.com/wordpress/wp-content/uploads/2009/10/hclusterstackexample.mxml">Cluster Stack Example</a></p>
<p><a href="http://www.webappsolution.com/wordpress/wp-content/uploads/2009/10/lineareaseriesexample.mxml">Linear Series Example</a></p>
<p><a href="http://www.webappsolution.com/wordpress/wp-content/uploads/2009/10/hclustercolumnexample.mxml">Cluster Column Example</a></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Axiis+Examples+with+Lots+of+Comments+http://4n3we.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=Axiis+Examples+with+Lots+of+Comments+http://4n3we.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/10/17/axiis-examples-with-lots-of-comments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Workaround to Flex SDK 3.4 Bug 22333 :: HTTPService Responders Are Called Twice&#8230;Here&#8217;s a Fix!</title>
		<link>http://www.webappsolution.com/wordpress/2009/09/29/workaround-to-flex-sdk-34-bug-22333-httpservice-responders-are-called-twiceheres-a-fix/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/09/29/workaround-to-flex-sdk-34-bug-22333-httpservice-responders-are-called-twiceheres-a-fix/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 17:21:27 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

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

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

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

		<category><![CDATA[flex-sdk-3.4]]></category>

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=551</guid>
		<description><![CDATA[This one kicked my team&#8217;s ass for a couple of hours so I&#8217;m hoping it&#8217;ll help somone else&#8230;so we updated our Flex SDKs to 3.4 and all of a sudden all of our Delegates&#8217; result handlers were getting called twice. We thought it was due to our service orchestration object (we have a base object [...]]]></description>
			<content:encoded><![CDATA[<p>This one kicked my team&#8217;s ass for a couple of hours so I&#8217;m hoping it&#8217;ll help somone else&#8230;so we updated our Flex SDKs to 3.4 and all of a sudden all of our Delegates&#8217; result handlers were getting called twice. We thought it was due to our service orchestration object (we have a base object that allows us to make sequential Cairngorm service calls) and somehow we were calling the services 2x, but nope&#8230;wasn&#8217;t it. Seemed our AbstractDelegate that sets up the responders for all of our service calls like so had the issue:</p>
<pre class="brush: as3;">
public function executeHTTPService(requestDTO:AbstractRequestDTO=null):void
{
	logger.debug(&quot;executeHTTPService&quot;);

	var token:AsyncToken;
	var responder:mx.rpc.Responder;

	// create a responder for the service
	responder = new mx.rpc.Responder(result, fault); // WTF mate?

	// execute the service
	token = this.service.send(requestDTO);
	token.addResponder(responder); // why yall busted up now???
}
</pre>
<p>Apparently, SDK 3.4 reintroduces an old defect that causes this implementation of setting up the responder with the async token to call the result handler twice&#8230;bummer, eh? So what to do&#8230;well, a simple workaround until they fix this is to do the following:</p>
<pre class="brush: as3;">
this.service.addEventListener(ResultEvent.RESULT, result);
this.service.addEventListener(FaultEvent.FAULT, fault);
</pre>
<p>Just create your handlers with good-ole fashioned event handlers&#8230;DONE.</p>
<p>Get more info on the defect <a href="http://bugs.adobe.com/jira/browse/SDK-22333" target="_blank">here</a>.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Workaround+to+Flex+SDK+3.4+Bug+22333+%3A%3A+HTTPService+Responders+Are+Called+Twice%E2%80%A6Here%E2%80%99s+a+Fix%21+http://973qg.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=Workaround+to+Flex+SDK+3.4+Bug+22333+%3A%3A+HTTPService+Responders+Are+Called+Twice%E2%80%A6Here%E2%80%99s+a+Fix%21+http://973qg.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/09/29/workaround-to-flex-sdk-34-bug-22333-httpservice-responders-are-called-twiceheres-a-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ActionScript Dependency Injection With RemoteClass Metadata Issue With Fix - UPDATED</title>
		<link>http://www.webappsolution.com/wordpress/2009/08/31/actionscript-dependency-injection-with-remoteclass-metadata-issue-with-fix/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/08/31/actionscript-dependency-injection-with-remoteclass-metadata-issue-with-fix/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 03:07:49 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

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

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

		<category><![CDATA[dependency-injection]]></category>

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

		<category><![CDATA[register-class-alias]]></category>

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=507</guid>
		<description><![CDATA[NOTE: My fix might be a little overkill, so I offer a simpler approach at the bottom of this post&#8230;and since this post still contains some good info on dynamically mapping classes at runtime leveraging the registerClassAlias() method, I decided to leave it as is sans this simple note.
Say you&#8217;re using Spring ActionScript (SAS) or [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE</strong>: My fix might be a little overkill, so I offer a simpler approach at the bottom of this post&#8230;and since this post still contains some good info on dynamically mapping classes at runtime leveraging the registerClassAlias() method, I decided to leave it as is sans this simple note.</p>
<p>Say you&#8217;re using <a href="http://www.springactionscript.org/" target="_blank">Spring ActionScript</a> (SAS) or <a href="http://code.google.com/p/swizframework/" target="_blank">Swiz</a> or some other ActionScript framework for <a href="http://www.ericfeminella.com/blog/2008/09/21/dependency-injection-iocdi-in-flex/" target="_blank">Dependency Injection</a> (DI) in conjunction with the RemoteObject&#8230;in most cases you&#8217;d like to map custom ActionScript Request and Response objects to a corresponding server-side Request and Response  object and you typically do so with a small bit of metadata in your AS class &#8212; just for an example, let&#8217;s say we have a Java LoginService with the following method signature:</p>
<pre class="brush: java;">
public LoginResponseDTO login(LoginRequestDTO request) throws LoginException
</pre>
<p>And the Java LoginRequestDTO looks like:</p>
<pre class="brush: java;">
package com.domain.myproj.dto.request;

public class LoginRequestDTO
{
	public String username;
	public String password;
}
</pre>
<p>Then we&#8217;d most likely have a corresponding LoginRequestDTO in ActionScript with the following class definition:</p>
<pre class="brush: as3;">
package test
{
	[RemoteClass(alias=&quot;com.domain.myproj.dto.request.LoginRequestDTO&quot;)]
	public class LoginRequestDTO extends test.AbstractRequestDTO
	{
		public var username:String;
		public var password:String;
	}
}
</pre>
<p>And via the magic of the client-side Flash Player and the server-side AMF Remoting Gateway in BlazeDS / LCDS / WebORB / GraniteDS, our ActionScript Request and Response Objects are serialized and deserialzied into their Java counterparts and all is well&#8230;<strong>the thing is, this is really only done with some big help from the Flex compiler and the all important RemoteClass metadata</strong>&#8230;ok, so what?&#8230;let&#8217;s do some further questioning and hypothesizing&#8230;</p>
<p>Well, let&#8217;s say you&#8217;re injecting your Business Delegates or whatever objects you&#8217;re using to actually invoke the server-side LoginService, where you&#8217;re also leveraging your cool, custom AS Req/Resp objects&#8230;well if you&#8217;re injecting your BDs, then you&#8217;re kind of injecting these other objects too, which means the compiler never actually sees the RemoteClass metadata in your Req/Resp objects&#8230;now this is very important, so I&#8217;ll repeat it in a slightly different way and with more definition to it&#8217;s importantce:</p>
<p><strong>If the compiler doesn&#8217;t actually know about or see the RemoteClass metadata, then not only will the mapping of your custom AS Req/Resp objects that are supposed to map to custom Java Req/Resp objects not happen, but even worse is that core AS Remoting objects that map to their corresponding core Java Remoting Objects (part of the very framework that makes the RemoteObject possible) does not take place.</strong></p>
<p>Go ahead&#8230;create an example and you&#8217;ll get a runtime error probably saying something like: </p>
<p><code>TypeError: Error #1034: Type Coercion failed: cannot convert Object@13e9921 to mx.messaging.messages.ErrorMessage.</code></p>
<p>So now you have 2 issues with the latter being the first priority, b/c if you don&#8217;t fix that then you don&#8217;t have to even worry about the custom mappings&#8230;head in hands&#8230;what to do? Well, I know Flash guys or doods writing in pure AS3 without the Flex Framework also run into issues when trying to leverage the RemoteObject, so I googled around a bit and found the answer with the registerClassAlias() method.</p>
<p>What we need to do is map each of the core AS Objects to the core Java Objects that are required for Java-RPC &#8212; http://forums.adobe.com/thread/295996</p>
<p>The registerClassAlias method allows developers to map client-side AS objects to server-side objects at runtime so the Flash Player can create the correct mappings&#8230;so to fix our issues we need to register the core objects and our custom objects.</p>
<p>I decided to wrap this in 2 objects: 1 for the framework mappings and a 2nd for the custom mappings:</p>
<p><strong>RegisterDataServicesClassAliases</strong></p>
<pre class="brush: as3;">/**
 * Web App Solution Confidential Information
 * Copyright 2009, Web App Solution
 *
 * @author Brian Riley
 * @date July, 6, 2009
 */
package com.webappsolution.roserviceinspector.util
{
	import com.webappsolution.springactionscript.util.IRegisterRemoteObjectClassAliases;
	import com.webappsolution.springactionscript.util.RegisterRemoteObjectClassAliases;

	public class RegisterDataServicesClassAliases extends RegisterRemoteObjectClassAliases implements IRegisterRemoteObjectClassAliases
	{
		/**
		 * Register all the custom request and response objects for the application.
		 */
		override public function registerCustomFlexDataServicesImpl():void
		{
			// REQUESTS
			//
			registerClassAlias(&quot;com.domain.myproj.dto.request.LoginRequestDTO&quot;, com.domain.myproj.dto.request.LoginRequestDTO);

			// RESPONSES
			//
		}
	}
}</pre>
<p><strong>RegisterRemoteObjectClassAliases</strong></p>
<pre class="brush: as3;">/**
 * Web App Solution Confidential Information
 * Copyright 2009, Web App Solution
 *
 * @author Brian Riley
 * @date July, 29, 2009
 */
package com.webappsolution.springactionscript.util
{
	import flash.net.registerClassAlias;

	import mx.collections.ArrayCollection;
	import mx.messaging.config.ConfigMap;
	import mx.messaging.messages.*;
	import mx.utils.ObjectProxy;

	/**
	 * This little gem maps client-side ActionScript objects to their servber-side Java counterparts
	 * at runtime.
	 *
	 * &lt;p&gt;
	 * Normally this is done via the metatdata tag for RemoteObjects [RemoteClass(alias=&quot;com.domain.project.MyDTO&quot;)]
	 * and the compiler automatically creates the base AS to Java class mappings for the Flex Data Services in
	 * LCDS / BlazeDS / WebORB / GraniteDS...
	 * &lt;/p&gt;
	 *
	 * &lt;p&gt;
	 * However, there are cases where developers either don't create the metadata or inject these DTOs
	 * at runtime and thus the compiler never actually sees the metadata, so we're left to do the class
	 * mappings at runtime.
	 * &lt;/p&gt;
	 *
	 * &lt;p&gt;
	 * This class provides developers with a couple options: The developer can choose to map all the Flex
	 * Data Service components with the &lt;code&gt;public static registerFlexDataServices()&lt;/code&gt; method or
	 * they can simply call the &lt;code&gt;public static registerAll()&lt;/code&gt; method; they can also put a list
	 * of custom mappings for custom requerst and response objects in the
	 * &lt;code&gt;public static registerCustomFlexDataServices()&lt;/code&gt; method.
	 * &lt;/p&gt;
	 */
	public class RegisterRemoteObjectClassAliases
	{
		/**
		 * Constructor
		 */
		public function RegisterRemoteObjectClassAliases()
		{

		}

		/**
		 *
		 */
		public function registerAll():void
		{
			registerFlexDataServices();
			registerFlexDataServicesMisc();
			registerCustomFlexDataServices();
		}

		/**
		 * Registers the base Flex Data Service Java reguest and response objects to the base
		 * ActionScript reguest and response objects.
		 */
		public function registerFlexDataServices():void
		{
			/*
			http://forums.adobe.com/thread/295996

			I think one problem is that the various mx.messaging.messages.Message
			implementations have not called registerClassAlias() for each
			of their types. In Flex, the compiler notices the [RemoteClass] metadata
			on each ActionScript class and codegens static initializer code to call
			registerClassAlias() while the application is initializing (so
			that it occurs before any data is sent or received).

			Note you can see this generated code if you specify
			-keep-generated-actionscript=true on the command line arguments for
			mxmlc. For compiling a file called test.mxml, find the
			/generated/_test_FlexInit-generated.as file and notice the calls to
			registerClassAlias.
			*/

			// See http://www.mail-archive.com/flexcoders@yahoogroups.com/msg74512.html
			// For explanation as to why this is needed. Without it, messages were not getting mapped correctly
			// from server. 

			registerClassAlias(&quot;flex.messaging.messages.RemotingMessage&quot;, RemotingMessage);
			registerClassAlias(&quot;flex.messaging.messages.ErrorMessage&quot;, ErrorMessage);
			registerClassAlias(&quot;flex.messaging.messages.CommandMessage&quot;,CommandMessage);
			registerClassAlias(&quot;flex.messaging.messages.AcknowledgeMessage&quot;, AcknowledgeMessage);
//			registerClassAlias(&quot;flex.messaging.io.ArrayList&quot;, ArrayList);
			registerClassAlias(&quot;flex.messaging.config.ConfigMap&quot;, ConfigMap);
			registerClassAlias(&quot;flex.messaging.io.ArrayCollection&quot;, ArrayCollection);
			registerClassAlias(&quot;flex.messaging.io.ObjectProxy&quot;, ObjectProxy);

			// You may want to register pub/sub and other rpc message types too...
			registerClassAlias(&quot;flex.messaging.messages.HTTPMessage&quot;, HTTPRequestMessage);
			registerClassAlias(&quot;flex.messaging.messages.SOAPMessage&quot;, SOAPMessage);
			registerClassAlias(&quot;flex.messaging.messages.AsyncMessage&quot;, AsyncMessage);
			registerClassAlias(&quot;flex.messaging.messages.MessagePerformance Info&quot;, MessagePerformanceInfo);
		}

		/**
		 * Additional message types...doesn't work in Flex 2.0.1 SDK, so comment out the
		 * the body of the method if that's the case.
		 */
		public function registerFlexDataServicesMisc():void
		{
//			registerClassAlias(&quot;DSA&quot;, AsyncMessageExt); // doesn't work in Flex 2.0.1 SDK
//			registerClassAlias(&quot;DSC&quot;, CommandMessageExt); // doesn't work in Flex 2.0.1 SDK
//			registerClassAlias(&quot;DSK&quot;, AcknowledgeMessageExt); // doesn't work in Flex 2.0.1 SDK
		}

		/**
		 * Registers the custom Java reguest and response objects to the custom ActionScript reguest and response objects.
		 * Developers should list their custom objects here.
		 */
		public function registerCustomFlexDataServices():void
		{
			// map the Java Data Transfer Object passed over HTTP back to Flex to the AS object
			registerCustomFlexDataServicesImpl();
		}

		/**
		 * Concrete classes must override this method, as this is just a hook operation.
		 */
		public function registerCustomFlexDataServicesImpl():void
		{
			// concrete classes must override this bad boy
		}

	}
}</pre>
<p>And then I simply call the following somewhere in my app&#8217;s initialization process (very early on):</p>
<pre class="brush: as3;">
private function registerDataServices():void
{
	logger.debug(&quot;registerDataServices&quot;);

	var registerROAliases:RegisterDataServicesClassAliases;

	// since we're injecting classes at runtime we need to set up the registerClassAlias() to
	// Flex Data Service classes manually
	registerROAliases = new RegisterDataServicesClassAliases();
	registerROAliases.registerAll();
}
</pre>
<p>And voila! We&#8217;re back in business. </p>
<p>I&#8217;d like to thank my local, Boston Adobe Flex guru for providing the basic solution to my issue in the following link: <a href="http://forums.adobe.com/thread/295996" target="_blank">http://forums.adobe.com/thread/295996</a></p>
<p><strong>UPDATED FIX:</strong></p>
<p>So I&#8217;m an idiot or rather someone that tends to overarchitect/think things sometimes&#8230;everywhere else in my app I simply make sure my classes injected at runtime are compiled into the app by simply referencing them somewhere else in the app or by putting them into a properties file like so:</p>
<p><code>LoginRequestDTO	= ClassReference("com.domain.myproj.dto.request.LoginRequestDTO")</code></p>
<p>This will force the compilation of the LoginRequestDTO and thus allow the compiler to see the RemoteClass metadata&#8230;but at least you know more about what the metadata does and how it works in conjunction with the Flex compiler <img src='http://www.webappsolution.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=ActionScript+Dependency+Injection+With+RemoteClass+Metadata+Issue+With+Fix+-+UPDATED+http://3gc86.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=ActionScript+Dependency+Injection+With+RemoteClass+Metadata+Issue+With+Fix+-+UPDATED+http://3gc86.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/08/31/actionscript-dependency-injection-with-remoteclass-metadata-issue-with-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java byte[] to ActionScript String - UPDATED</title>
		<link>http://www.webappsolution.com/wordpress/2009/07/30/java-byte-to-actionscript-string/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/07/30/java-byte-to-actionscript-string/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 16:56:59 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=471</guid>
		<description><![CDATA[I recently needed to send a Java byte[] to Flex that ultimately needed to be converted to an ActionScript String on the Flex side. I wrestled with it for a bit before I realized that I needed to make the byte[] on the Java side encoded with UTF-8.
Here&#8217;s a quick EchoService I created in Java [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to send a Java byte[] to Flex that ultimately needed to be converted to an ActionScript String on the Flex side. I wrestled with it for a bit before I realized that I needed to make the byte[] on the Java side encoded with UTF-8.</p>
<p>Here&#8217;s a quick EchoService I created in Java that takes a String parameter from Flex, converts it into a byte[], and then sends it back to Flex, as well as the accompanying Flex code that handles the service&#8217;s result and transforms the byte[] back into a String in ActionScript.</p>
<pre class="brush: java;">package com.wasi.services.test;

import java.io.UnsupportedEncodingException;

public class EchoService
{
	public String echo(String param)
	{
		return param;
	}

	public int echo(int param)
	{
		return param;
	}

	public byte[] echoStringToByte(String param)
	{
		System.out.println(&quot;echoStringToByte: &quot; + param);

		byte[] byteArray = null;

		try
		{
			byteArray = param.getBytes(&quot;UTF-8&quot;);
		}
		catch (UnsupportedEncodingException e)
		{
			e.printStackTrace();
		}
		return byteArray;
	}

}</pre>
<p>And on the Flex side:</p>
<pre class="brush: as3;">import mx.rpc.remoting.mxml.RemoteObject;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

private var echoStringToByteService:RemoteObject;

private function init():void
{
	trace(&quot;init&quot;);

	this.echoStringToByteService = new RemoteObject();
	this.echoStringToByteService.destination = &quot;echoService&quot;;
	this.echoStringToByteService.endpoint = &quot;http://localhost:8080/bds/messagebroker/amf&quot;;
	this.echoStringToByteService.showBusyCursor = true;
	this.echoStringToByteService.addEventListener(ResultEvent.RESULT, onEchoStringToByteServiceResult);
	this.echoStringToByteService.addEventListener(FaultEvent.FAULT, onEchoStringToByteServiceFault);
}

private function onEchoServiceSubmit(evt:MouseEvent):void
{
	trace(&quot;onEchoServiceSubmit&quot;);

	var str:String;

	str = this.echoStringTextInput.text;
	this.echoStringToByteService.echoStringToByte(str);
}

private function onEchoStringToByteServiceResult(evt:ResultEvent):void
{
	trace(&quot;onEchoStringToByteServiceResult&quot;);

	var byteArray:ByteArray;

	byteArray = evt.result as ByteArray;

	// both the readUTFBytes() and toString() methods give return you the string
	trace(&quot;onEchoStringToByteServiceResult readUTFBytes = &quot; + byteArray.readUTFBytes(byteArray.bytesAvailable));
	trace(&quot;onEchoStringToByteServiceResult toString = &quot; + byteArray.toString());

	this.echoServiceResultText.text = byteArray.readUTFBytes(byteArray.bytesAvailable);
}

private function onEchoStringToByteServiceFault(evt:FaultEvent):void
{
	trace(&quot;onEchoStringToByteServiceFault&quot;);
}</pre>
<p>In order to run this you&#8217;ll need to:</p>
<ul>
<li>Copy and paste the ActionScript listed above into a Flex Application tat calls the init() method on creationComplete.</li>
<li>Have BlazeDS or LCDS running on a server (as you can see in the definition of my RemoteObject in Flex I created a small Java web-app with a context root of /bds).</li>
<li>Configure remoting-config.xml by adding in the following destination node listed below.</li>
</ul>
<pre class="brush: xml;">&lt;destination id=&quot;echoService&quot;&gt;
	&lt;properties&gt;
		&lt;source&gt;com.wasi.services.test.EchoService&lt;/source&gt;
		&lt;scope&gt;application&lt;/scope&gt;
	&lt;/properties&gt;
&lt;/destination&gt;</pre>
<p><strong>NOTE:</strong> I removed a couple things for clarity and this code has not been retested to verify that it still runs, but you should get the idea.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Java+byte%5B%5D+to+ActionScript+String+-+UPDATED+http://kkmcw.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=Java+byte%5B%5D+to+ActionScript+String+-+UPDATED+http://kkmcw.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/07/30/java-byte-to-actionscript-string/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wordpress Plugin SyntaxHighlighter Test On ActionScript 3</title>
		<link>http://www.webappsolution.com/wordpress/2009/06/29/wordpress-plugin-syntaxhighlighter-test-on-actionscript-3/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/06/29/wordpress-plugin-syntaxhighlighter-test-on-actionscript-3/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 20:35:33 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

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

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

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=413</guid>
		<description><![CDATA[This is a test post to determine if I like SyntaxHighlighter as a source code plugin for Wordpress. Here&#8217;s two ActionScript 3 examples:
private var foo:Bar = new Bar();
/**
 * Web App Solution Confidential Information
 * Copyright 2009, Web App Solution, Inc.
 *
 * @author Brian Riley
 * @date June, 29, 2009
 */
package com.wasi.test
{
	import com.wasi.test.interfaces.IFooBar;

	/**
	 * [...]]]></description>
			<content:encoded><![CDATA[<p>This is a test post to determine if I like <a href="http://wordpress.org/extend/plugins/syntaxhighlighter/installation/" target="_blank">SyntaxHighlighter</a> as a source code plugin for Wordpress. Here&#8217;s two ActionScript 3 examples:</p>
<pre class="brush: as3;">private var foo:Bar = new Bar();</pre>
<pre class="brush: actionscript3;">/**
 * Web App Solution Confidential Information
 * Copyright 2009, Web App Solution, Inc.
 *
 * @author Brian Riley
 * @date June, 29, 2009
 */
package com.wasi.test
{
	import com.wasi.test.interfaces.IFooBar;

	/**
	 * This class rocks my world.
	 */
	public class Foo extends Bar implements IFooBar
	{
		/**
		 * Constant happy value.
		 */
		public var myLongString:String = &quot;this is a really, really long string to illustrate what happens when one line of code is tooooo long&quot;;

		/**
		 * Constant happy value.
		 */
		private static const MY_CONST:String = &quot;myPrivateStaticConstant&quot;;

		/**
		 * Constructor.
		 *
		 * param myFoo	A String vlaue that's happy.
		 * param myBar	A Number vlaue that's sad.
		 */
		public function Foo(myFoo:String, myFoo:Number)
		{
			// TODO
		}

	}
}</pre>
<p>Just wrap your source code in the following syntax:</p>
<p>[<strong>sourceCodeAlias</strong>]</p>
<p>my source code</p>
<p>[/<strong>sourceCodeAlias</strong>]</p>
<p>where <strong>sourceCodeAlias</strong> = as3 or actionscript3. <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Brushes" target="_blank">Here&#8217;s the full list of possible code syntax highlighters at your disposal</a>.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Wordpress+Plugin+SyntaxHighlighter+Test+On+ActionScript+3+http://c4f6p.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=Wordpress+Plugin+SyntaxHighlighter+Test+On+ActionScript+3+http://c4f6p.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/06/29/wordpress-plugin-syntaxhighlighter-test-on-actionscript-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ActionScript ArrayCollection Binding and Event Dispatching</title>
		<link>http://www.webappsolution.com/wordpress/2009/04/22/actionscript-arraycollection-binding-and-event-dispatching/</link>
		<comments>http://www.webappsolution.com/wordpress/2009/04/22/actionscript-arraycollection-binding-and-event-dispatching/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 22:06:11 +0000</pubDate>
		<dc:creator>brianr</dc:creator>
		
		<category><![CDATA[actionscript]]></category>

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

		<category><![CDATA[array-collection]]></category>

		<category><![CDATA[data-binding]]></category>

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

		<category><![CDATA[event-disptaching]]></category>

		<guid isPermaLink="false">http://www.webappsolution.com/wordpress/?p=60</guid>
		<description><![CDATA[We hear this one a lot, so I&#8217;m throwing it out there as a reminder for new and old Flex and ActionScript developers&#8230;
You&#8217;ll get some new collection data say from a remote service and you simply update your model level ArrayCollection (&#8221;AC&#8221;) property by doing:

myModel.myAC = responseFromRemoteService.myNewAC;

And low and behold the objects that are either [...]]]></description>
			<content:encoded><![CDATA[<p>We hear this one a lot, so I&#8217;m throwing it out there as a reminder for new and old Flex and ActionScript developers&#8230;</p>
<p>You&#8217;ll get some new collection data say from a remote service and you simply update your model level ArrayCollection (&#8221;AC&#8221;) property by doing:</p>
<p><code><br />
myModel.myAC = responseFromRemoteService.myNewAC;<br />
</code></p>
<p>And low and behold the objects that are either binding to it or listening for the change event don&#8217;t do anything??? What? How the? But I debugged it and I saw that the new data was getting stored in my model-level AC&#8230;how come this thing isn&#8217;t working? Stoopid Flex&#8230;bleh.</p>
<p>Well, it&#8217;s simply because setting the original AC to a new AC doesn&#8217;t implicitly fire off any change events (which is the underlying implementation for data binding as well.) In order to make this function as expected, one simply needs to set the <strong>source</strong> property on an AC like so:</p>
<p><code><br />
myModel.myAC.source = responseFromRemoteService.myNewAC.source;<br />
</code></p>
<p>The source property in an AC is not only the underlying Array for an AC, but also fires off that change event (I believe it&#8217;s the <code>listChanged</code> type event) that&#8217;s so important to binding and anyone else listening for changes on that AC. Truth be told, this is actually done in the underlying ListCollectionView class that an AC inherits from, but that&#8217;s just details.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=ActionScript+ArrayCollection+Binding+and+Event+Dispatching+http://ry5gm.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=ActionScript+ArrayCollection+Binding+and+Event+Dispatching+http://ry5gm.th8.us" title="Post to Twitter">Tweet This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.webappsolution.com/wordpress/2009/04/22/actionscript-arraycollection-binding-and-event-dispatching/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

