<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bustardcelly &#187; AS3</title>
	<atom:link href="http://custardbelly.com/blog/?feed=rss2&#038;cat=5" rel="self" type="application/rss+xml" />
	<link>http://custardbelly.com/blog</link>
	<description>it&#039;s a long story</description>
	<lastBuildDate>Tue, 24 Aug 2010 14:25:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introducing as3flobile components</title>
		<link>http://custardbelly.com/blog/?p=173</link>
		<comments>http://custardbelly.com/blog/?p=173#comments</comments>
		<pubDate>Tue, 24 Aug 2010 13:12:41 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[as3flobile]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=173</guid>
		<description><![CDATA[The library is available on github at bustardcelly/as3flobile. You can read more detailed information on the wiki. You can also look at the online docs. Continue reading if you enjoy rambling explanations.
As per usual, i had started a personal project that focused on refining parts of an old application and ended up creating a new [...]]]></description>
			<content:encoded><![CDATA[<p><em>The library is available on github at <a href="http://github.com/bustardcelly/as3flobile" target="_blank">bustardcelly/as3flobile</a>. You can read more detailed information on <a href="http://wiki.github.com/bustardcelly/as3flobile/" target="_blank">the wiki</a>. You can also look at the <a href="http://www.custardbelly.com/android/froyo/as3flobile/docs/" target="_blank">online docs</a>. Continue reading if you enjoy rambling explanations.</em></p>
<p>As per usual, i had started a personal project that focused on refining parts of an old application and ended up creating a new library. This time, that application was going to get a face lift as i tried to port some code over to <strong>AS3</strong>-only views with the goal of targeting <strong>Android</strong> devices. What seemed like a little side project turned into a fun, can&#8217;t-stop-thinking-about suite of custom <strong>ActionScript 3</strong> components.</p>
<p>You can view the components here: <a href="http://www.custardbelly.com/android/froyo/as3flobile/">http://www.custardbelly.com/android/froyo/as3flobile/</a>. If you have a Flash-enabled device, please check them out and let me know how they run. I have only really tested on my Nexus 1.</p>
<p><a href="http://www.custardbelly.com/android/froyo/as3flobile/"><img src="http://www.custardbelly.com/blog/images/as3flobile.jpg" alt="as3flobile components" /></a></p>
<p>A full list of the current components is available on the <a href="http://wiki.github.com/bustardcelly/as3flobile/" target="_blank">project&#8217;s wiki</a> in <a href="http://github.com/bustardcelly/as3flobile" target="_blank">github</a>. The main intent of creating these controls was to start thinking about user gesture as recognition and navigation within a control. My first task was to forget about scrollbars. They have essentially become useless on touch-devices in the context of navigating through content of a defined area. Though <strong>as3flobile</strong> does provide scrollbars in a sense (they are called <strong>Sliders</strong>) they are meant for selecting a value within a range, not as a handrail to hold onto to traverse items in a list. As a visual clue, the scrollbar still makes sense. As a user-input model, it is slowly not.</p>
<p>In any event, scrolling was the first gesture tackled. So I mainly started out making a <strong>ScrollViewport</strong> and then went crazy making all these other controls i know i would need <em><strong>if i ever got back to the original task at hand</strong></em> <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I could talk more in depth on how i tackled scrolling and how i kept the API open for you to create your own scrolling contexts and plug them in in later posts if you&#8217;d like.</p>
<p>There is some tap recognition, such as when selecting a list item or a <strong>RadioButton</strong>, but most of the focus is on swipe gesture for scrolling. I would like to start diving into other gestures (ie. zoom)  which would probably make me rethink the architecture of a custom component for a touch-device, not only in its gesture recognition but also how you interact to access information. For instance, does a drop down really make any sense any more? (though there is a <strong>DropDown</strong> in <strong>as3flobile</strong>) I don&#8217;t know if i am the only one, but it really feels antiquated to me. I wonder if there will come a time when we are old and we look at old pictures of the online forms we used to fill out with there funny old clunky controls&#8230; how much time was wasted.</p>
<p><em><strong>You keep talking, but can you skin them?</strong></em></p>
<p>Yes, you can skin them. There really isn&#8217;t a skinning architecture in <strong>as3flobile</strong> per se. Any control that is a subclass of <strong>AS3FlobileComponent</strong> (which all the controls in the library currently are) can accept an <strong>ISkin</strong> and can maintain a state related to or rather accessible by an <strong>ISkin</strong>. Furthermore, the assignment, targeting and update to the skins is handled within <strong>AS3FlobileComponent</strong> with protected hook-ins you can override if seen fit. </p>
<p>However, if you look at the default skins within <strong>as3flobile</strong>, in <strong>com.custardbelly.as3flobile.skins.*</strong>, you&#8217;ll see that the <strong>ISkin</strong> implementations actually reference their target controls directly to access the graphic displays needed for custom skinning. I figured there was no reason to add extra overhead by creating interfaces for a control strictly for skinning purposes. If you create a custom skin for a control, it is assumed you know what the control needs to look like; so access it directly. Though the <strong>target</strong> property of <strong>ISkin</strong> is <strong>ISkinnable</strong> (which <strong>AS3FlobileComponent</strong> implements), the target is most times cast to the specific control that is being skinned. If people are really interested in these components and curious as to how to skin them, i can definitely fire up some more posts on that.</p>
<p>In any event, i hope you check out the <strong>as3flobile</strong> <a href="http://wiki.github.com/bustardcelly/as3flobile/" target="_blank">project in github</a> and/or <a href="http://30.media.tumblr.com/tumblr_l7foigmQIN1qzzw5do1_500.jpg" target="_blank">get down to business as Gary always seems to do</a>. If you do check out the <strong>as3flobile</strong> project, suggestions, comments and questions are always appreciated. I am sure there are some bugs and some aspects of the controls that i just didn&#8217;t think of that may be needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=173</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Announcing as3couchdb Library</title>
		<link>http://custardbelly.com/blog/?p=147</link>
		<comments>http://custardbelly.com/blog/?p=147#comments</comments>
		<pubDate>Tue, 13 Apr 2010 09:15:23 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[as3couchdb]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=147</guid>
		<description><![CDATA[The library is available on github at bustardcelly/as3couchdb. You can read more detailed information on the wiki. Continue reading to hear me blab on and on.
When the new year came and i had finally got in my last chapter for Flex 4 Cookbook, it was time to return to my list of things to learn. [...]]]></description>
			<content:encoded><![CDATA[<p><em>The library is available on github at <a href="http://github.com/bustardcelly/as3couchdb">bustardcelly/as3couchdb</a>. You can read more detailed information on <a href="http://wiki.github.com/bustardcelly/as3couchdb/">the wiki</a>. Continue reading to hear me blab on and on.</em></p>
<p>When the new year came and i had finally got in <a href="http://custardbelly.com/blog/?p=132" target="_blank">my last chapter</a> for <a href="http://www.amazon.com/Flex-Cookbook-Real-world-developing-Applications/dp/0596805616/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1271029122&#038;sr=8-1" target="_blank">Flex 4 Cookbook</a>, it was time to return to my list of things to learn. I started looking into <strong>Capuccino</strong> and <strong>Closure</strong> and bought a book on <strong>Python</strong>. Somewhere along the way i just clicked on some tweet about 5 emerging trends that <em>i must know about</em>. Usually i find these lists are a grain-of-salt bandwagon of buzzery &#8211; maybe some truth but can&#8217;t cut through the true meaning of why this person is writing about them. But one did stick &#8211; <strong>NoSQL</strong>. I looked into the different implementations and right away i took a fancy to <strong><a href="http://couchdb.apache.org/" target="_blank">CouchDB</a></strong>. I don&#8217;t know why. It seemed quite simple. Working with a database using <strong>REST</strong> calls. Sounds good. And i could write my own map-reduce views in Javascript. Sign me up.</p>
<p>What also was a big draw to me was the concept of document revisions in <strong>CouchDB</strong>. I had worked on a couple projects that required <strong>online/offline synchronization</strong> and it was quite a pain to keep track of last modified entries and cleanup of deleted entries in a SQL database. The revisioning system for documents (entries) is built into <strong>CouchDB</strong> and what is more is that you are not locked into a rigid data structure and ensure your table relations are scalable. That&#8217;s not to say that building relational databases isn&#8217;t a fine art. It is. And there are many smarter people than me that get paid more money that have that craft. I don&#8217;t. The concept of revisions is familiar to me and i am greatly intrigued by the concept of <strong>NoSQL</strong>.</p>
<p>Anyway, i started digging into <strong><a href="http://couchdb.apache.org/" target="_blank">CouchDB</a></strong> and figured the one way for me to see the whole picture was to hook up a client side end to make these requests. See if what i was reading about was something i could use as a different approach to <strong>online/offline synchronization</strong> in my applications. What came out was a whole library for working with databases and documents of a <strong>CouchDB</strong> instance &#8211; a library which is now available on <strong>github</strong> at <a href="http://github.com/bustardcelly/as3couchdb">http://github.com/bustardcelly/as3couchdb</a>.</p>
<p>Took me long enough to get talking about the <strong>as3couchdb</strong> library mentioned in the title, didn&#8217;t it? Well, you can read more long-winded explanations about the make-up of the library from <a href="http://wiki.github.com/bustardcelly/as3couchdb/" target="_blank">the wiki on github</a>, and browse <a href="http://github.com/bustardcelly/as3couchdb/tree/master/examples/flex/" target="_blank">some examples that use the library</a> (currently all Flex examples, but AS3 examples are coming soon).</p>
<p>If you are still around, i can give a brief synopsis of the project:</p>
<p>When i set out on creating the <a href="http://github.com/bustardcelly/as3couchdb" target="_blank">as3couchdb</a> library, i knew i wanted to follow a similar approach to <a href="http://en.wikipedia.org/wiki/Data_access_object" target="_blank"><strong>Data Access Objects</strong></a>. I wanted to make all my requests through the object i was working with and have an intermediate layer that communicate with the service and updated the object accordingly. To achieve this, i went about creating a <em>base model</em> class that contains a <em>model entity</em>. The <em>model entity</em> is really only involved in parsing custom metadata and resolving the information to properties held on the <em>base model</em>. Extending the <em>base model</em> are the two core models of <strong>CouchDB</strong> that you interact with: the <em>Database</em> and the <em>Document</em>.</p>
<p>So the <em>Database</em> and <em>Document</em> models can be though of as the <strong>Business Objects</strong> and expose methods that related to <strong>CRUD</strong> operations. <em>Even though <strong><a href="http://couchdb.apache.org/" target="_blank">CouchDB</a></strong> has a <strong>REST</strong> API, i chose using simple <strong>CRUD</strong> method signitures on the models as they seem easier to read and understand.</em> From these methods, the models interact with a <em>service mediator</em> (similar to <strong>Data Access Object</strong>), which knows how to communicate with the service proxy and has <em>action handlers</em> that know how to modify the model once a successful result is received. To put it in code terms:</p>
<p><em>I wanted to have the ease of creating and storing a document as such</em></p>
<p><code>var contact:ContactDocument = new ContactDocument();<br />
contact.firstName = "Todd";<br />
contact.lastName = "Anderson";<br />
contact.addEventListener(CouchActionType.CREATE, handleContactCreate);<br />
contact.create();</code></p>
<p><em>And the ease to simply read in for modification as such:</em></p>
<p><code>var contact:ContactDocument = new ContactDocument();<br />
contact.addEventListener(CoachActionType.READ, handleContactRead);<br />
contact.read( $uid );</code></p>
<p>In order to make this all work and auto-wire the models with a <em>service mediator</em>, custom annotations were needed. This is where the <em>model entity</em> mentioned earlier comes into play. When extending the core models (as <strong>ContactDocument</strong> does in the previous examples) you add custom metadata that relates to the <strong>CouchDB</strong> instance you intend to work with and the fully qualified classnames of the target <em>service mediator</em> and <em>request object</em>.</p>
<p>Now the <em>request object</em> is a different story and was brought into the picture due to the lack of HTTP method types available for the web version of <strong>Flash Player</strong>. As such, there are a couple different <em>request object</em> types available in <strong>as3couchdb</strong>: straight-up devil-may-care requests using <strong>URLRequest</strong> (mainly for <strong>AIR</strong> or you will get RTEs), one that uses <strong>External Interface</strong>, and one that uses <a href="http://github.com/gabriel/as3httpclient" target="_blank">as3httpclientlib</a>. The <a href="http://github.com/gabriel/as3httpclient" target="_blank">as3httpclientlib</a> allows you to make PUT and DELETE requests using a <strong>Socket</strong> and is the best way to interact with a <strong>RESTful</strong> service when limited to the Flash web player (imho).</p>
<p>So that is a brief rundown of the model and business layer implementation i strove for when creating <strong>as3couchdb</strong>. As i mentioned way back in upward-page-scroll land, the original drive to make <strong>as3couchdb</strong> was to see if i could ease up the pain of developing an application that uses <strong>online/offline synchronization</strong>. That is in the works and maybe this blog will become a little more active as I dive into that task.</p>
<p>If you made it this far, thank you for reading all this. Wow. You are a trooper. Tell your boss i said it is okay and you can bill that time.</p>
<p>Link-link time!<br />
CouchDB &#8211; <a href="http://couchdb.apache.org/" target="_blank">http://couchdb.apache.org/</a><br />
CouchDB: The Definitive Guide &#8211; <a href="http://books.couchdb.org/relax/" target="_blank">http://books.couchdb.org/relax/</a><br />
CouchDB: Wiki &#8211; <a href="http://wiki.apache.org/couchdb/FrontPage" target="_blank">http://wiki.apache.org/couchdb/FrontPage</a><br />
Planet CouchDB &#8211; <a href="http://planet.couchdb.org/" target="_blank">http://planet.couchdb.org/</a><br />
MongoDB, CouchDB and MySQL Compare Grid &#8211; <a href="http://www.mongodb.org/display/DOCS/MongoDB,+CouchDB,+MySQL+Compare+Grid" target="_blank">http://www.mongodb.org/display/DOCS/MongoDB,+CouchDB,+MySQL+Compare+Grid</a><br />
as3httpclientlib &#8211; <a href="http://github.com/gabriel/as3httpclient" target="_blank">http://github.com/gabriel/as3httpclient</a></p>
<p>More information about the custom metadata, and the inner workings of as3couchdb can be found <a href="http://wiki.github.com/bustardcelly/as3couchdb/">on the wiki</a> for the <a href="http://github.com/bustardcelly/as3couchdb">project in github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=147</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex 3 Cookbook clarifications</title>
		<link>http://custardbelly.com/blog/?p=73</link>
		<comments>http://custardbelly.com/blog/?p=73#comments</comments>
		<pubDate>Wed, 16 Jul 2008 00:01:41 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=73</guid>
		<description><![CDATA[Josh Noble &#8211; the main man behind the Flex 3 Cookbook of which i had the esteem pleasure of being part of (thanks again, j-man) &#8211; has recently blogged about some more information involving the files for download and the intention of the book.
Wanted to blog about it as well, as i feel there is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thefactoryfactory.com/wordpress/" target="_blank">Josh Noble</a> &#8211; the main man behind the <a href="http://www.amazon.com/Flex-Cookbook-Code-Recipes-Developers-Developer/dp/0596529856/ref=pd_sim_b_2" target="_blank">Flex 3 Cookbook</a> of which i had the esteem pleasure of being part of (thanks again, j-man) &#8211; has <a href="http://thefactoryfactory.com/wordpress/?p=435">recently blogged</a> about some more information involving the files for download and the intention of the book.</p>
<p>Wanted to blog about it as well, as i feel there is some great information from his post about the decision for cutting chapters and where to download code and the best way to submit errata. He also mentions the heartbreaking decision to cut chapters and recipes from the book to preserve page count&#8230; but don&#8217;t put the book back on the shelf, they are available to download!</p>
<p>We hope people are enjoying the book at what any level developer you are. Cheers to Josh and happy coding!</p>
<p><a href="http://thefactoryfactory.com/wordpress/?p=435">read Josh&#8217;s post</a></p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yet another post about Astro</title>
		<link>http://custardbelly.com/blog/?p=72</link>
		<comments>http://custardbelly.com/blog/?p=72#comments</comments>
		<pubDate>Fri, 16 May 2008 02:25:21 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Astro]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=72</guid>
		<description><![CDATA[If you read MXNA, you probably have stopped checking quite some time ago because every post is about Astro&#8230;
but if you are interested in another way to set up your projects in FlexBuilder to target FP10 without having to muck about with files in the frameworks folder of your original Flex3 SDK installation this post [...]]]></description>
			<content:encoded><![CDATA[<p>If you read MXNA, you probably have stopped checking quite some time ago because every post is about <a href="http://labs.adobe.com/technologies/flashplayer10/"  target="_blank">Astro</a>&#8230;<br />
but if you are interested in another way to set up your projects in FlexBuilder to target FP10 without having to muck about with files in the frameworks folder of your <em>original</em> Flex3 SDK installation this post may shed some light.</p>
<p>I am a workspace fanatic when it comes to development. I like things tidy, and when i start a new client project or go into some new exploration that involves multiple projects, i create a new workspace. The great thing about workspaces for me, aside from keeping things neat in my head, is that each new project you create in that workspace inherits from any default settings. So <a href="http://blogs.zdnet.com/Stewart/?p=841" target="_blank">when the big news hit</a> and i wanted to check out the latest SDK, i created a new workspace and followed <em>most</em> of the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x">excellent directions already available on the adobe open source site</a>. I only strayed a little in how i went about setting my workspace up so that every new project i created in it was *almost* set for development targeted at FP10 without having to run through the process each time. </p>
<p>The following is the process i took to only mess with the files from the nightly build and set defaults for a single workspace in order to play around with the current features available in Astro:<br />
<strong><br />
1</strong>. Download Flash Player 10 codenamed Astro.<br />
<strong>2</strong>. Download the nightly build and unzip to some directory. (for me that is /Applications/flex_sdk_3.0.1.1728<br />
<strong>3</strong>. Open FlexBuilder or Eclipse (if you have the plugin) and create a new workspace. (ie. ~/Documents/workspace/astro).<br />
<strong>4</strong>. Create a new project.<br />
<strong>5</strong>. Navigate to Project>Properties<br />
<strong>6</strong>. Select the Flex Compiler option<br />
<strong>7</strong>. Under Flex SDK version, click Configure Flex SDKs&#8230;<br />
<strong>8</strong>. In the Preferences (Filtered) window, select Add<br />
<strong>9.</strong> Navigate to the installation of your nightly build. (ie. /Applications/flex_sdk_3.0.1.1728)<br />
<strong>10</strong>. Add a new name for the SDK&#8230; you should see something like so:</p>
<p><img src="http://custardbelly.com/blog/images/astro.jpg" alt="Flex Builder Astro set up"/>&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8217;                                                                                                          </p>
<p><strong>11</strong>. Click OK, Then tick the checkbox next to the newly added sdk in the Installed Flex SDKs window.<br />
<strong>12</strong>. Click Apply, then OK.<br />
<strong>13</strong>. Then back in the Project Properties folder, under Use a specific SDK, if the newly added SDK isn&#8217;t selected, select it.<br />
<strong>14</strong>. Under the Required Flash Player Version, change the value to 10.0.0<br />
<strong>15</strong>. In the Project Properties window on the left side, select Flex Build Path> Library Path.<br />
<strong>16</strong>. Expand the SDK you just set as default, and select the playerglobal.swc and Remove it.<br />
<strong>17</strong>. Click Add SWC, and navigate to the player 10 swc from your nightly build SDK installation (ie. /Applications/flex_sdk_3.0.1.1728/frameworks/libs/player/10/playerglobal.swc)<br />
<strong>18</strong>. Click Apply, then OK.<br />
<strong>19</strong>. Open up the flex-config.xml file from the Astro SDK installation and update the settings <a href="http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x" target="_blank">as described in the first part of the Command-line Compiler instructions from here</a>.</p>
<p>Thats it! Only 19 steps&#8230; that seems like a lot. In any case, in ensures that any project you now build under that workspace will default to using the targeted SDK. You will still have to manually change the Required Flash Version (from step 14) before you compile a new project, but other than that when you want to tinker with the nightly build &#8211; and not mess with your stable Flex 3 SDK release that other projects in other workspaces are targeting &#8211; just hop over to that workspace.<br />
<strong><br />
Good reading</strong>:<br />
Ryan Stewart &#8211; <a href="http://blogs.zdnet.com/Stewart/?p=841">Flash Player 10 codename &#8220;Astro&#8221; goes beta</a><br />
Tinic Uro &#8211; <a href="http://www.kaourantin.net/">Adobe Is Making Noise series</a><br />
Keith Peters &#8211; <a href="http://www.bit-101.com/blog/?p=1264">Astro Dynamic Sound!</a><br />
Josh Tynjala &#8211; <a href="http://www.zeuslabs.us/2008/05/15/gratuitous-text-effects-courtesy-of-flash-player-10/">Gratuitous Text Effects</a></p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=72</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Prana and compiled classes</title>
		<link>http://custardbelly.com/blog/?p=71</link>
		<comments>http://custardbelly.com/blog/?p=71#comments</comments>
		<pubDate>Sat, 10 May 2008 18:58:51 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Prana]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=71</guid>
		<description><![CDATA[I have recently gotten into incorporating Prana &#8211; the Inversion of Control framework of AS3 created by Christophe Herreman- into my projects. I gotta say, it&#8217;s beautiful piece of work and makes me rethink my approach to the architecture of applications again.
I don&#8217;t want to go into IoC and dependency injection and how your applications [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently gotten into incorporating <a href="http://www.pranaframework.org/" target="_blank">Prana &#8211; the Inversion of Control framework of AS3</a> created by <a href="http://www.herrodius.com/blog/" target="_blank">Christophe Herreman</a>- into my projects. I gotta say, it&#8217;s beautiful piece of work and makes me rethink my approach to the architecture of applications again.</p>
<p>I don&#8217;t want to go into IoC and dependency injection and how your applications can truly benefit by using the <a href="http://www.pranaframework.org/" target="_blank">Prana</a> framework, as this post may get pretty long and these references are much better reading than my rambling:</p>
<p>Christophe&#8217;s blog: <a href="http://www.herrodius.com/blog/" target="_blank">http://www.herrodius.com/blog/</a><br />
Martin Fowler&#8217;s <a href="http://martinfowler.com/articles/injection.html" target="_blank">Inversion of Control Containers and the Dependency injection pattern</a><br />
<a href="http://en.wikipedia.org/wiki/Hollywood_Principle" target="_blank">the hollywood principle</a></p>
<p>What i did want to bring up is that i had a small problem with the workflow and how i develop. Which is my problem, of course <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but nonetheless&#8230;</p>
<p>One important thing to remember is that the context file is an external file that is loaded by the application at runtime. This means you will need to have all the possible classes your application <em>may</em> use already compiled into the SWF in order for the objects to be instantiated and your application to work. If you are typing to interfaces, this could prove to be a bit of a problem. You could create a reference for each class that may be needed in another class that is known to be compiled into the SWF &#8211; as Christophe explains <a href="http://www.herrodius.com/blog/65">in this post</a> &#8211; but that always seemed dirty to me. </p>
<p>As is mentioned in the comments to that <a href="http://www.herrodius.com/blog/65">post</a>, you can also go about adding each class using the -includes compiler option. Adding all possible classes using the -includes option makes for an excellent case on when to use additional compiler configurations, and presents the option to really just change the application context file and the additional configuration file as the project sees fit, without having to open up the source and tack on or remove dummy references to classes.</p>
<p>As an example, take for instance this application context file:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;objects<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;property file=<span style="color: #ff0000;">&quot;app.properties&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Handles direct invocation on client --&gt;</span></span>
	<span style="color: #000000;">&lt;object id=<span style="color: #ff0000;">&quot;callbackHandler&quot;</span> class=<span style="color: #ff0000;">&quot;com.example.responder.CallbackResponderImpl&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Handles connection to Red5 application --&gt;</span></span>
	<span style="color: #000000;">&lt;object id=<span style="color: #ff0000;">&quot;connectionDelegate&quot;</span> class=<span style="color: #ff0000;">&quot;com.example.business.ConnectionDelegateImpl&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;property name=<span style="color: #ff0000;">&quot;rtmpURI&quot;</span> value=<span style="color: #ff0000;">&quot;${app.rtmpURI}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;">&lt;property name=<span style="color: #ff0000;">&quot;client&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;ref<span style="color: #7400FF;">&gt;</span></span>callbackHandler<span style="color: #000000;">&lt;/ref<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;/property<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/object<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;/objects<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>.. for each possible implementation of <strong>ConnectionDelegate</strong> and <strong>CallbackResponder</strong> that i may decide to swap in and out as the project seems fit, i would either need to hold a reference to each implementation in some class sure or be compiled into the SWF, or i could store them in an additional config file that can be added using the -load-config option with an additional value:</p>
<p>The <strong>prana.config</strong> file:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;flex -config<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;includes append=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;symbol<span style="color: #7400FF;">&gt;</span></span>com.example.reponder.CallbackResponderImpl<span style="color: #000000;">&lt;/symbol<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;symbol<span style="color: #7400FF;">&gt;</span></span>com.example.business.ConnectionDelegateImpl<span style="color: #000000;">&lt;/symbol<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/includes<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;/flex<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>&#8230; drop that in my source folder and add the compiler option:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">-load-config+=prana.config</pre></div></div>

<p>From there, i could change the context as i see fit, update the prana.config file to reflect my preferences and just recompile the application without having to go into the source and muck about. It&#8217;s a little more clean for me and allows me to happily go about using the <a href="http://www.pranaframework.org/" target="_blank">Prana</a> framework.</p>
<p>The best part is that <a href="http://www.herrodius.com/blog/64">Prana is truthfully AS3 compliant</a>! Meaning you can use it in your Flex <em>AND</em> AS3 projects, which cannot be said for some frameworks that claim to be AS3 and actually use class from the mx package&#8230; (looking at you <a href="http://code.google.com/p/as3lib/">as3lib</a>). <em>A huge pet-peeve of mine.</em><br />
*Last i checked, the source under version control doesn&#8217;t seem to reflect the current changes <a href="http://www.herrodius.com/blog/" target="_blank">Christophe</a> has made, but they are included in the downloads.</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=71</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Looking back and looking forward</title>
		<link>http://custardbelly.com/blog/?p=69</link>
		<comments>http://custardbelly.com/blog/?p=69#comments</comments>
		<pubDate>Sun, 24 Feb 2008 15:22:28 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Infrared5]]></category>
		<category><![CDATA[Red5]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=69</guid>
		<description><![CDATA[For those of you that still follow this blog, you may have noticed that i have not been too knee-deep in blogging. A measly 5 posts ago, i rambled on about what 2007 might bring. Needless to say it had kept me pretty busy &#8211; and for all good reason. I have had the opportunity [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you that still follow this blog, you may have noticed that i have not been too knee-deep in blogging. A measly 5 posts ago, <a href="http://custardbelly.com/blog/?p=58" target="_blank">i rambled on</a> about what 2007 might bring. Needless to say it had kept me pretty busy &#8211; and for all good reason. I have had the opportunity to work alongside some unbelievably talented people and be a part of two amazing books focused on <a href="http://labs.adobe.com/technologies/air/" target="_blank">Adobe AIR</a> and <a href="http://labs.adobe.com/technologies/flex/" target="_blank">Flex 3</a> that will be hitting shelves soon. I also accepted a position at <a href="http://www.infrared5.com" target="_blank">Infrared5</a> and am looking forward to working with some of the most insane and brilliant minds in the industry.</p>
<p><a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_8?ie=UTF8&#038;s=books&#038;qid=1203806020&#038;sr=8-8"><img src="http://www.custardbelly.com/blog/images/air_cmr.jpg" alt="AIR Create-Modify-Reuse" /></a><br />
Marc Leuchner and Matt Wright (of <a href="http://blog.nobien.net/" target="_blank">NoBien</a> fame) and I have been burning the midnight oil to deliver an exciting book on <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_8?ie=UTF8&#038;s=books&#038;qid=1203806020&#038;sr=8-8">Adobe AIR &#8211; AIR Create-Reuse-Modify</a> from Wiley Wrox press. Each chapter walks through building applications as you learn about the AIR API. We had a lot of fun architecting and writing about each application that highlights specific facets of the platform and hope it is as much fun to read. Adobe AIR and the API is part of the Flex 3 SDK, which might be <a href="http://www.onflex.org/ted/2008/02/flex-30-and-air-10-are-days-away.php" target="_blank">coming out soon</a>&#8230;</p>
<p><a href="http://www.amazon.com/Flex-3-Cookbook-Joshua-Noble/dp/0596529856/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1203806666&#038;sr=8-1"><img src="http://www.custardbelly.com/blog/images/cookbook.jpg" alt="Flex 3 cookbook" /></a><br />
Well, i didn&#8217;t stop at discussing one part of the Flex 3 SDK and also was asked by <a href="http://thefactoryfactory.com/wordpress/" target="_blank">Josh Noble</a> to be a co-author for the <a href="http://www.amazon.com/Flex-3-Cookbook-Joshua-Noble/dp/0596529856/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1203806666&#038;sr=8-1">Flex 3 Cookbook</a> from the O&#8217;Reilly press. We&#8217;ve gathered the submissions from the Adobe <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=homepage&#038;productId=2" target="_blank">online cookbook</a> and Josh has been steering the cookbook ship to greatness. If you are unfamiliar with the <a href="http://www.oreilly.com/store/series/cookbooks.csp" target="_blank">O&#8217;Reilly cookbook</a> format, the book is designed to present hundreds of &#8216;recipes&#8217; aimed at solving programming problems. I have had the extreme pleasure to write about parts of the Flex API that i love and believe to be essential to RIAs developed using the Flash Platform.</p>
<p>If writing didn&#8217;t keep me busy enough, I worked with some amazing people while building applications that stretched the possibilities of what online and desktop applications built in Flex can do. Along the way i learned more about the business, some agile practices (which i hope to write about some) and how to have fun and love what i do. It is an amazing thing.</p>
<p><a href="http://infrared5.com" target="_blank"><img src="http://www.custardbelly.com/blog/images/infrared5.gif" alt="Infrared5" /></a><br />
I also have had the opportunity to join the <a href="http://www.infrared5.com" target="_blank">Infrared5</a> team and could not be happier. Infrared5 is a consulting company started by Chris Allen, Rebecca Allen and Dominick Accattato focused on architecting applications using the Flash Platform and Red5 Server technologies. <a href="http://bit-101.com/blog" target="_blank">Keith</a> summed it up pretty well <a href="http://www.bit-101.com/blog/?p=1163#comments">in this post</a>. I am honored to be in company with some of the brightest minds in the field that keep me laughing throughout the day. Once I stop breaking things around the office, i can settle in and learn something <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>All in all, 2007 was a great year and i am making out 2008 to be even better. Here&#8217;s to posting more!</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Customizing the Apollo NativeWindow</title>
		<link>http://custardbelly.com/blog/?p=60</link>
		<comments>http://custardbelly.com/blog/?p=60#comments</comments>
		<pubDate>Fri, 06 Apr 2007 11:50:27 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=60</guid>
		<description><![CDATA[Daniel Dura wrote up a great post on adding Flex components to NativeWindows. If you are looking to add Flex components to your NativeWindow instance, you will need to follow what Daniel described.  As Daniel has mentioned, this is an issue concerning the alpha version of Apollo and may be cleared up in the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danieldura.com/" target="_blank">Daniel Dura</a> wrote up a <a href="http://www.danieldura.com/archive/apollo-multi-window-support-using-flex"  target="_blank">great post</a> on adding Flex components to NativeWindows. If you are looking to add Flex components to your NativeWindow instance, you will need to follow what Daniel described.  As Daniel has mentioned, this is an issue concerning the <a href="http://www.adobe.com/go/apollo"  target="_blank">alpha version of Apollo</a> and may be cleared up in the next release, but if you can&#8217;t wait and are looking to add custom ActionScript components that extend Flex components, there is another option. </p>
<p>I don&#8217;t pretend to know enough about the architecture (so someone speak up if i am off track), but adding components to NativeWindows &#8211; without Daniel&#8217;s or the proceeding example- fails due to the reference to your main ApolloApplication&#8217;s stage when displaying components within the Flex framework. You can add all the displays existent in the AS3 library (Sprite, TextField, etc.) to the stage of your NativeWindow instance, but any in the Flex framework need a little push. Adding MXML components to your NativeWindows will still have to follow the formula Daniel laid out using the addChild/removeChild methods, yet there is a workaround to this for ActionScript components by adding an ADDED_TO_STAGE event listener within its constructor.</p>
<p>I have a tendency to try and word things right and it comes out all mush, so i&#8217;ll just show some code. <em>You can alternatively look at<a href="http://custardbelly.com/downloads/apollo/NativeWindowExample" target="_blank"> source view</a></em>. </p>
<p>The CustomLabel (CustomLabel.as) component that will be added to our NativeWindow:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">        <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">containers</span>.<span style="color: #006600;">Canvas</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CustomLabel <span style="color: #0066CC;">extends</span> Canvas
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _label:<span style="color: #0066CC;">TextField</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> CustomLabel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ADDED_TO_STAGE</span>, init <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span> evt:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			createChildren<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> createChildren<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span>.<span style="color: #006600;">createChildren</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_label = createField<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;HelloWorld&quot;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> _label <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span> unscaledWidth:<span style="color: #0066CC;">Number</span>, unscaledHeight:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span>.<span style="color: #006600;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span> unscaledWidth, unscaledHeight <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createField<span style="color: #66cc66;">&#40;</span> txt:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">TextField</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> label:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			label.<span style="color: #0066CC;">text</span> = txt;
			<span style="color: #b1b100;">return</span> label;	
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>&#8230; And the main mxml  (NativeWindowExample.mxml):</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;mx :ApolloApplication </span>
<span style="color: #000000;">	xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">	width=<span style="color: #ff0000;">&quot;200&quot;</span></span>
<span style="color: #000000;">	height=<span style="color: #ff0000;">&quot;100&quot;</span> </span>
<span style="color: #000000;">	layout=<span style="color: #ff0000;">&quot;absolute&quot;</span></span>
<span style="color: #000000;">	applicationComplete=<span style="color: #ff0000;">&quot;onAppInit();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
&nbsp;
<span style="color: #000000;">			private var _launchWindow:NativeWindow;</span>
<span style="color: #000000;">			private var _customWindow:NativeWindow;</span>
&nbsp;
<span style="color: #000000;">			private function onAppInit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				_launchWindow = this.stage.window;</span>
<span style="color: #000000;">				_launchWindow.addEventListener<span style="color: #66cc66;">&#40;</span> Event.CLOSE, onAppClose <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">			private function openCustomWindow<span style="color: #66cc66;">&#40;</span> evt:MouseEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				if<span style="color: #66cc66;">&#40;</span> _customWindow != null <span style="color: #66cc66;">&#41;</span> return;</span>
&nbsp;
<span style="color: #000000;">				var options:NativeWindowInitOptions = new NativeWindowInitOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">				_customWindow = new NativeWindow<span style="color: #66cc66;">&#40;</span> true, options <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">				_customWindow.stage.align = StageAlign.TOP_LEFT;</span>
<span style="color: #000000;">				_customWindow.stage.scaleMode = StageScaleMode.NO_SCALE;</span>
<span style="color: #000000;">				_customWindow.title = <span style="color: #ff0000;">&quot;CustomWindow&quot;</span>;</span>
<span style="color: #000000;">				_customWindow.stage.addChild<span style="color: #66cc66;">&#40;</span> new CustomLabel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">				_customWindow.addEventListener<span style="color: #66cc66;">&#40;</span> Event.CLOSE, onWindowClose <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">			private function onWindowClose<span style="color: #66cc66;">&#40;</span> evt:Event <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				_customWindow = null;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">			private function onAppClose<span style="color: #66cc66;">&#40;</span> evt:Event <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				if<span style="color: #66cc66;">&#40;</span> _customWindow != null <span style="color: #66cc66;">&#41;</span> _customWindow.close<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;mx :Button id=<span style="color: #ff0000;">&quot;windowBtn&quot;</span> </span>
<span style="color: #000000;">		top=<span style="color: #ff0000;">&quot;10&quot;</span> left=<span style="color: #ff0000;">&quot;10&quot;</span> right=<span style="color: #ff0000;">&quot;10&quot;</span> bottom=<span style="color: #ff0000;">&quot;10&quot;</span></span>
<span style="color: #000000;">		label=<span style="color: #ff0000;">&quot;open custom window&quot;</span></span>
<span style="color: #000000;">		click=<span style="color: #ff0000;">&quot;openCustomWindow( event );&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p><strong>NOTE:</strong> <em>the preceding code has some major problems due to mx tags in wordpress, so disregard all affending close tags <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<p> &#8212; As well, you could extend NativeWindow and add the AS components to its stage to bypass adding them in the main app. &#8211;</p>
<p>In the main app file we are just creating a new NativeWindow instance and adding the custom AS component, CustomLabel, to it&#8217;s display.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_customWindow.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> CustomLabel<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>What is happening in the constructor of the CustomLabel is of importance in this example, as it listens for its event of being added to a clients stage. From there we can call the override of UIComponent:createChildren, and add whatever we want to the display. When creating AS components NOT to be added to the NativeWindow, that method (createChildren) would be called as long as you call the super constructor. That is not the case when adding components extending the Flex framework in NativeWindow. Again, if i am missing something crucial or if you have more insight, please leave a comment. So that&#8217;s it. Once it has been added to the stage, we can go about our business. Of course, when using ActionScript components you lose the inherent layout capabilities within MXML components, but that is why we&#8217;ve added the override of #updateDisplayList.<br />
Until Flex came around, i know i spent more than my fair share nailing down layouts for applications- so this is like going back home&#8230; <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To find out more about extending ActionScript components, visit<a href="http://blog.flashgen.com/2006/11/08/base-component-methods-actionscript-20-to-30/"  target="_blank"> this post</a> on FlashGen and <a href="http://download.macromedia.com/pub/documentation/en/flex/2/flex2_createextendcomponents.pdf"  target="_blank">this doc</a> from <a href="http://labs.adobe.com/">the labs</a>.</p>
<p>PS. I&#8217;ve been a little lacking in the post area, and though i have the usual excuses- family, work, beer&#8230; &#8211; i could be more on top of it and you should be seeing more Flex and Apollo thoughts in the near future, but no promises because i love those excuses. I also am working on something that i hope to announce here a little later if all goes well&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=60</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASDoc and Keith Peters&#8217; FlashDevelop templates</title>
		<link>http://custardbelly.com/blog/?p=55</link>
		<comments>http://custardbelly.com/blog/?p=55#comments</comments>
		<pubDate>Tue, 29 Aug 2006 02:50:58 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=55</guid>
		<description><![CDATA[&#8230; via Joa Eberts fairwell to AS3Doc &#8230;
Adobe had release their ASDoc command line tool around the 11th- i was otherwise occupied, but am happy to find a way to figure documentation into Keith Peters&#8217; FlashDevelop templates for Flex2 and As3 projects now that i am back at my computer.
( If you haven&#8217;t already, follow [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; via <a href="http://blog.je2050.de/?p=80" target="_blank">Joa Eberts fairwell to AS3Doc</a> &#8230;</p>
<p><a href="http://www.adobe.com/" target="_blank">Adobe</a> had release their <a href="http://labs.adobe.com/wiki/index.php/ASDoc" target="_blank">ASDoc command line tool</a> around the 11th- i was otherwise <a href="http://custardbelly.com/blog/?p=54" target="_blank">occupied</a>, but am happy to find a way to figure documentation into <a href="http://www.bit-101.com/blog/?p=849" target="_blank">Keith Peters&#8217; FlashDevelop templates for Flex2 and As3 projects</a> now that i am back at my computer.</p>
<p>( If you haven&#8217;t already, follow that l<a href="http://www.bit-101.com/blog/?p=849" target="_blank">ink to Keith&#8217;s tutorial</a> on adding project templates if you are interested in creating an excellent dev environment in FD and are curious about what i added to target auto-documentation in the ANT process ). </p>
<p>To sum it up, all i added was a couple properties to the build.properties file and a conditional target to the build.xml. The modified files are here:</p>
<p><a href="http://custardbelly.com/downloads/fd/build.properties" target="_blank">build.properties</a><br />
<a href="http://custardbelly.com/downloads/fd/build.xml" target="_blank">build.xml</a></p>
<p>&#8230; be aware that these are modified files downloaded from keith&#8217;s post, so if you have changed some values in the properties file on your own machine you shouldn&#8217;t explicitly replace these with your own.</p>
<p>[Note: it's not really actionscript code below, i'm just being lazy]</p>
<p><strong>The additions to <em>build.properties</em></strong>:</p>
<p><em>1 &#8211; under the project properties header&#8230;</em><br />
[as]#document titles<br />
docbuild=false<br />
doc.maintitle=templatetest<br />
doc.windowtitle=&#8217;template test&#8217;[/as]<br />
<em><br />
&#8230; the docbuild property is a string boolean evaluated in a conditional in the build.xml. The others are command params <a href="http://labs.adobe.com/wiki/index.php/ASDoc:Using_ASDoc" target="_blank">found here</a>. Remember that anything with spaces needs quotes around it, as is the value for doc.windowtitle.</em></p>
<p><em>2 &#8211; under the tools header&#8230;</em><br />
[as]# where you installed your documenter:<br />
asdoc.dir=C:/Flex_2_sdk<br />
&#8230;<br />
# most of this shouldn&#8217;t need to change<br />
&#8230;<br />
documenter=bin/asdoc.exe<br />
&#8230;<br />
[/as]</p>
<p><em>&#8230; where asdoc.dir and documenter are relative to where you unzipped the ASDoc &#8211; in this case i threw it into the directory of the sdk.</em></p>
<p><strong>the additions to <em>build.xml:</em></strong></p>
<p><em>1- conditional added to the compile target:</em><br />
[as]<condition property="builddocument"><br />
<equals arg1="${docbuild}" arg2="true"/><br />
</condition><br />
[/as]<br />
<em>2 &#8211; the document target</em><br />
[as]<target name="document" if="builddocument"><br />
	<exec executable="${asdoc.dir}/${documenter}"><br />
            <arg line="-source-path ${source.dir} -doc-sources ${source.dir}/. -main-title ${doc.maintitle} -window-title ${doc.windowtitle} -output ${doc.dir}"/><br />
         </exec><br />
</target><br />
[/as]<br />
<em>3 &#8211; antcall added to build target:</em><br />
[as]<antcall target="document"/>[/as]</p>
<p>&#8230; Changing the doc.build value in build.properties to any string other than &#8216;true&#8217; will cause this to not rebuild the documentation, which can be handy if you are just doing quick tests or bug finding &#8211; otherwise, if set to &#8216;true&#8217; it will document any AS files recursively found in ${source.dir}.</p>
<p>I had a similar build made up for AS2 projects and <a href="http://www.blinex.com/index.cfm?view=bldoc&#038;nav_view=products" target="_blank">BlDoc</a> in FlashDevelop using ANT earlier and thought i&#8217;d have a go with it using <a href="http://labs.adobe.com/wiki/index.php/ASDoc" target="_blank">ASDoc</a>, maybe someone else will find this useful&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AS3 LCD Donkee Kong Jr</title>
		<link>http://custardbelly.com/blog/?p=51</link>
		<comments>http://custardbelly.com/blog/?p=51#comments</comments>
		<pubDate>Wed, 05 Jul 2006 11:53:50 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=51</guid>
		<description><![CDATA[click to play. Flash Player 9 required.

After i brought those old Game&#038;Watch handhelds home, i started playing them heavily. After being beat into submission hundreds of times i began thinking &#8216;these games are too damn hard&#8217; &#8211; so i put them down and decided to try and recreate one in Actionscript3&#8230; here&#8217;s the first one [...]]]></description>
			<content:encoded><![CDATA[<p>click to play. <a href="http://www.adobe.com/products/flashplayer/">Flash Player 9</a> required.<br />
<a href="javascript:MM_openBrWindow('http://www.custardbelly.com/dev/junior/index.html', 'dk_jr','resizable=no,width=340,height=280')" alt="click to play"><img src="http://www.custardbelly.com/blog/images/dkjr.gif" alt="click me"/></a></p>
<p>After i brought those old Game&#038;Watch <a href="http://custardbelly.com/blog/?p=49" target="_blank">handhelds home</a>, i started playing them heavily. After being beat into submission hundreds of times i began thinking &#8216;these games are too damn hard&#8217; &#8211; so i put them down and decided to try and recreate one in <a href="http://livedocs.macromedia.com/flex/2/langref/index.html" target="_blank">Actionscript3</a>&#8230; here&#8217;s the first one i came out with &#8211; a remake of Donkey Kong Jr from the widescreen <a href="http://gameandwatch.com/" target="_blank">Game&#038;Watch</a> series.</p>
<p>With the previous games i have worked on, i employed a pixel collision detection system to drive game play- but when thinking about LCD games, spaces on the screen are reserved and there is no real overlap of pixels to detected when an enemy runs into a hero, an enemy connects with a projectile, etc. Instead i had to employ a sort-of &#8216;mother may i&#8217; management system where a call is made from every &#8216;object&#8217; prior to it&#8217;s bitmap update to see if anything is in between where what block it&#8217;s in and what block needs to be rendered next. The development was based mainly on <a href="http://electronics.howstuffworks.com/lcd7.htm" target="_blank">Passive Matrix LCDs</a>. </p>
<p>Ultimately how it is put together is by loading a graphics sheet with all the states for each &#8216;player&#8217; and then basing it&#8217;s rendered state upon game interaction and a list of state &#8216;matrices&#8217;. On each &#8216;allowance&#8217; of movement the bitmapdata is cleared and redrawn with a new state. And in the case of the enemies, based on your progression through the game, the &#8216;allowance&#8217; timing is sped up.</p>
<p>The biggest thing i have gained from working this through is the beauty of the new <a href="http://livedocs.macromedia.com/flex/2/langref/index.html" target="_blank">Timer class</a>. With the introduction of BitmapData in Flash8 As2 i began rethinking how i was developing, and now with the Timer class i&#8217;m doing it again. I loved onEnterFrame for so long, but that just wasn&#8217;t gonna hack it for this project&#8230; and i&#8217;m glad it didn&#8217;t.</p>
<p>I kept the architecture pretty open for easy adaptation and extension so that i could make more of these LCD games with ease, but i think i have to step away for a bit. Sound would be a good addition to this and i plan to do a little work on that, but i&#8217;m getting pretty busy.<br />
Enough talk, enjoy the game and keep in mind that this is a rough prototype, so you may encounter a bug or two <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>AS3 2d tilescroller source</title>
		<link>http://custardbelly.com/blog/?p=49</link>
		<comments>http://custardbelly.com/blog/?p=49#comments</comments>
		<pubDate>Fri, 09 Jun 2006 11:58:23 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=49</guid>
		<description><![CDATA[view swf and source here.
I trimmed down some processes and stripped any excess so the classes included focus just on the tile scroller. In my previous post the movement was based upon the position of the sprite- here it&#8217;s based soley on keystrokes. It also utilizes some of my ImagesLoader classes. 
The real meat is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.custardbelly.com/downloads/as3/TileScroller/index.html">view swf and source here.</a></p>
<p>I trimmed down some processes and stripped any excess so the classes included focus just on the tile scroller. In <a href="http://custardbelly.com/blog/?p=47">my previous post</a> the movement was based upon the position of the sprite- here it&#8217;s based soley on keystrokes. It also utilizes some of <a href="http://custardbelly.com/blog/?p=43">my ImagesLoader</a> classes. </p>
<p>The real meat is in the updateScroll method of the MapScrollLayer class. That handles all the update of bitmapdata to the gridded tiles, and redraw/scroll of the displayed bitmap.<br />
One thing i found exciting was creating custom namespaces. If you take a peek at com.custard.as3.models.TileLayerMap, in the constructor it creates a 2d array based on the data type.</p>
<p>I had planned to make a fuller presentation with some tutorial-like explanations, but my time is pretty thin right now. If enough people are interested in that, i&#8217;d definitely get on top of it. A basic understanding of OOP may be needed to gather something from the code. i don&#8217;t really plan to go that much into it, but if you are a little rusty, unfamiliar with the concept, or want to learn more, <a href="http://blog.benstucki.net/">Ben Stucki</a> is going into that this month on his blog.</p>
<p>&#8230;also&#8230;</p>
<p>every time i go back home to my parents&#8217;, there&#8217;s some more boxes of &#8216;junk&#8217; that have been sitting in the basement, stuck in some dark corner, since my room was turned into an office.<br />
this past weekend i went through another said box, and pulled out this bounty!</p>
<p><img src="http://custardbelly.com/blog/images/gamewatch.gif" alt="game&#038;watch" /></p>
<p>had forgotten all about these guys&#8230;</p>
<p>i&#8217;m waiting for the box that had my old <a href="http://en.wikipedia.org/wiki/Image:Etch-A-Sketch_Animator.jpg">etch-a-sketch animator gadget</a>. man, i loved that thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=49</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
