<?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>XposureDesign</title>
	<atom:link href="http://xposuredesign.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://xposuredesign.net</link>
	<description>Programming, Technology, Web Development, Whatever</description>
	<lastBuildDate>Mon, 16 Aug 2010 04:52:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CRUD problem in IE6 with cfajaxproxy</title>
		<link>http://xposuredesign.net/?p=326</link>
		<comments>http://xposuredesign.net/?p=326#comments</comments>
		<pubDate>Mon, 09 Aug 2010 16:47:25 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[cfajaxproxy]]></category>
		<category><![CDATA[cfc]]></category>
		<category><![CDATA[crud]]></category>
		<category><![CDATA[dao]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[object expected]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=326</guid>
		<description><![CDATA[When using the CFC generator in Coldfusion Builder to create a DAO for a database table, Coldfusion will create four functions within this file, namely create, read, update, and delete. When creating a Javascript object out of the CFC using cfajaxproxy, Coldfusion will populate your document with Javascript that contains the names of these functions]]></description>
			<content:encoded><![CDATA[<p>When using the CFC generator in Coldfusion Builder to create a DAO for a database table, Coldfusion will create four functions <a href="http://xposuredesign.net/wp-content/uploads/2010/08/error1.jpg"><img class="size-full wp-image-331 alignleft" title="IE6 Error" src="http://xposuredesign.net/wp-content/uploads/2010/08/error1.jpg" alt="" width="46" height="200" /></a>within this file, namely <em>create, read, update, </em>and <em>delete</em>. When creating a Javascript object out of the CFC using cfajaxproxy, Coldfusion will populate your document with Javascript that contains the names of these functions in the document. This will break IE6.</p>
<p>Typically this wouldn&#8217;t be a problem, however the trouble arises when the document is populated with the last function: <em>delete</em>. Whereas Coldfusion sees <em>delete </em>as a function within the CFC, however <em>delete </em>in Javascript is a reserved word to deallocate dynamically allocated memory. All other browsers (including IE7+) recognizes that delete is indeed a function of your CFC, however IE6 simply recognizes it as a reserved word, and discontinues parsing the pages Javascript, resulting in <em>Object Expected</em> errors when other Javascript code is executed. To get around this, you simply need to rename the delete function in the CFC to something different.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=326</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introduction to cfajaxproxy</title>
		<link>http://xposuredesign.net/?p=276</link>
		<comments>http://xposuredesign.net/?p=276#comments</comments>
		<pubDate>Mon, 19 Jul 2010 18:44:44 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[cfajaxproxy]]></category>
		<category><![CDATA[cfc]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=276</guid>
		<description><![CDATA[I&#8217;ve been using Coldfusion for quite some time now, but only recently have I taken advantage of what seems to be a relatively unknown or at least poorly publicized feature called cfajaxproxy, which allows you to create a Javascript object from a CFC, and dynamically interact with Coldfusion using Javascript functions.let&#8217;s start with the basics,]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Coldfusion for quite some time now, but only recently have I taken advantage of what seems to be a relatively unknown or at least poorly publicized feature called cfajaxproxy, which allows you to create a Javascript object from a CFC, and dynamically interact with Coldfusion using Javascript functions.<span id="more-276"></span>let&#8217;s start with the basics, there are a few properties for cfajaxproxy. According to the Coldfusion 8 documentation, there are two ways to use this tag:</p>
<blockquote>
<pre>&lt;cfajaxproxy
    cfc = "<em>CFC name</em>"
    jsclassname = "<em>JavaScript proxy class name</em>"&gt;
<strong>OR</strong> 

&lt;cfajaxproxy
    bind = "<em>bind expression</em>"
    onError = "<em>JavaScript function name</em>"
    onSuccess = "<em>JavaScript function name</em>"&gt;</pre>
</blockquote>
<p>I&#8217;m going to talk about the former method as It allows for more control. Let&#8217;s say I have a Coldfusion <em>datefield</em> input, and I want it to load data that occurred on that date from a database. Lets start with the CFC:</p>
<pre class="brush: coldfusion;">
&lt;cfcomponent&gt;
	&lt;cffunction name=&quot;getTotal&quot; access=&quot;remote&quot; returntype=&quot;Numeric&quot;&gt;
		&lt;cfargument name=&quot;date&quot; type=&quot;date&quot; required=&quot;yes&quot;&gt;

		&lt;cfset var myQry = &quot;&quot;&gt;

		&lt;cfquery name=&quot;myQry&quot; datasource=&quot;myDatasource&quot;&gt;
			SELECT COUNT(id) as dailyTotal FROM myTable
			WHERE date BETWEEN
			CONVERT(datetime,&lt;cfqueryparam value=&quot;#ARGUMENTS.date#&quot; cfsqltype=&quot;cf_sql_date&quot;&gt;,101) AND
			DATEADD(day,1,CONVERT(datetime,&lt;cfqueryparam value=&quot;#ARGUMENTS.date#&quot; cfsqltype=&quot;cf_sql_date&quot;&gt;,101))
		&lt;/cfquery&gt;

		&lt;cfreturn myQry.dailyTotal&gt;
	&lt;/cffunction&gt;
&lt;/cfcomponent&gt;
</pre>
<p>For this example, lets pretend its called <em>myCFC.cfc</em>, which will be located in the same directory as the CFM. Now, the CFM looks like this:</p>
<pre class="brush: coldfusion;">
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Sample Coldfusion AJAX Page&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;cfform name=&quot;dataForm&quot; action=&quot;&quot;&gt;
			&lt;cfinput name=&quot;myDate&quot; type=&quot;datefield&quot;&gt;
			&lt;cfinput name=&quot;update&quot; type=&quot;button&quot;&gt;
		&lt;/cfform&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Here I have a (very) simple CFM with a form that has a datefield and a button field. Right now the page won&#8217;t do anything, but now we need to add the Ajax proxy and tell it how to handle the changed date.</p>
<pre class="brush: jscript; highlight: [1,10,11,12,22]; html-script: true;">
&lt;cfajaxproxy cfc=&quot;myCFC&quot; jsclassname=&quot;myCFC&quot;&gt;

&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Sample Coldfusion AJAX Page&lt;/title&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		function dateChange()
			{
			var myDate = document.getElementById(&quot;myDate&quot;);
			var cfc = new myCFC();
			cfc.setCallbackHandler(getDataResult);
			cfc.getTotal(myDate.value);
			}
		function getDataResult(result)
			{
			document.write(result);
			}
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;cfform name=&quot;dataForm&quot; action=&quot;&quot;&gt;
			&lt;cfinput name=&quot;myDate&quot; type=&quot;datefield&quot;&gt;
			&lt;cfinput name=&quot;update&quot; type=&quot;button&quot; onclick=&quot;dateChange();&quot;&gt;
		&lt;/cfform&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The critical elements are highlighted in the above code. I have added the <em>onClick </em>event listener to the update button in the form, and have made it call a Javascript method called dateChange. The cfajaxproxytag creates a new Javascript class named by the <em>jsclassname </em>property of the cfajaxproxytag. Inside the <em>dateChange </em>method, a new instance of the <em>myCFC </em>class is instantiated, and I tell Javascript to send the result to another method called <em>getDataResult</em>. Then the Coldfusion method <em>getTotal </em>is invoked using the matching Javascript function which is part of the Javascript class <em>myCFC</em>. Coldfusion then executes the function, and returns the data back to Javascript in the result argument of <em>getDataResult</em>, where you can perform additional operations with the data. In this instance, the result is written to the page.</p>
<p>A helpful tool in developing with cfajaxproxy is the Ajax debug log window, which can be enabled in the Coldfusion administrator under <em>Debug Output Settings</em>. <a href="http://xposuredesign.net/wp-content/uploads/2010/07/ajaxdebug.gif"><img class="aligncenter size-full wp-image-294" title="Ajax Debug Setting" src="http://xposuredesign.net/wp-content/uploads/2010/07/ajaxdebug.gif" alt="" width="485" height="70" /></a>Additionally, you will need to append <em>?cfdebug</em> to the end of the URL. For example:</p>
<pre>http://xposuredesign.net/ajax/index.cfm?cfdebug
</pre>
<p>That&#8217;s a simple introduction to the first implementation of cfajaxproxy. For more information on the capabilities of this snazzy Coldfusion feature check out the <a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_3.html">Coldfusion 8 Documentation</a> on the subject, or if you prefer the Coldfusion 9 flavor, its located <a href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-79f9.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=276</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable DataTip targets in Flex charts</title>
		<link>http://xposuredesign.net/?p=259</link>
		<comments>http://xposuredesign.net/?p=259#comments</comments>
		<pubDate>Thu, 13 May 2010 09:46:10 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[datatip]]></category>
		<category><![CDATA[dot]]></category>
		<category><![CDATA[point]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=259</guid>
		<description><![CDATA[After working on my new data visualization project at Grooveshark, I&#8217;ve been looking for a way to remove the DataTip &#8220;targets&#8221;, which I have considered calling &#8220;points&#8221;, &#8220;dots&#8221;, and &#8220;circles&#8221; in my search to turn these little things off. In case you don&#8217;t know what they are, here&#8217;s a picture: After trudging through the Flex]]></description>
			<content:encoded><![CDATA[<p>After working on my new data visualization project at Grooveshark, I&#8217;ve been looking for a way to remove the <em>DataTip </em>&#8220;targets&#8221;, which I have considered calling &#8220;points&#8221;, &#8220;dots&#8221;, and &#8220;circles&#8221; in my search to turn these little things off.</p>
<p>In case you don&#8217;t know what they are, here&#8217;s a picture:</p>
<p><img title="DataTip Target" src="http://xposuredesign.net/wp-content/uploads/2010/05/datatip.jpg" alt="" width="122" height="92" /><br/></p>
<p>After trudging through the Flex SDK source code, turns out its a simple style setting for the <em>ChartBase</em> class. Now I feel silly&#8230;</p>
<pre class="brush: as3;">
var myChart:ColumnChart = new ColumnChart();
myChart.setStyle(&quot;showDataTipTargets&quot;,false);</pre>
<p>or in MXML</p>
<pre class="brush: xml;">
&lt;mx:ColumnChart showDataTipTargets=&quot;false&quot;/&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=259</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7</title>
		<link>http://xposuredesign.net/?p=235</link>
		<comments>http://xposuredesign.net/?p=235#comments</comments>
		<pubDate>Fri, 19 Feb 2010 21:15:07 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=235</guid>
		<description><![CDATA[Windows Phone 7 was unveiled at World Mobile Conference last week. Since 2006, Microsoft has been struggling with its mobile market, losing much of its former market-share to Blackberry(RIM), Android, and of course the iPhone. So whats new about Windows Phone 7? Practically everything. The biggest change according to Joe Belfiore, the vice president of]]></description>
			<content:encoded><![CDATA[<p>Windows Phone 7 was unveiled at World Mobile Conference last week. Since 2006, Microsoft has been struggling with its mobile market, losing much of its former market-sha<a href="http://xposuredesign.net/wp-content/uploads/2010/02/wm7logo.png"><img class="alignleft size-full wp-image-250" title="Windows Phone 7" src="http://xposuredesign.net/wp-content/uploads/2010/02/wm7logo.png" alt="" width="125" height="125" /></a>re to Blackberry(RIM), Android, and of course the iPhone. So whats new about Windows Phone 7? Practically everything. The biggest change according to Joe Belfiore, the vice president of Windows Phone program management, is &#8220;a shift in focus from buisness and enterprise users to end users&#8221;. So, what does this mean? Basically a more customizable, better-looking UI, more features everyday people want, and close integration with social networking. Windows phone 7 aggregates many services together into hubs like pictures, music, mail, etc. It integrates things like Facebook, Twitter, Myspace, Live, Gmail, etc. to pull all the relevant information into that hub. For example in the pictures hub there would be your Facebook pictures, camera pictures, Myspace pictures, Flikr pictures, etc. The UI is also completely different, and is reminiscent of the Zune/Windows Media Center kinetic text look.</p>
<p>So is all this going to rekindle Microsoft&#8217;s smartphone market share? Will it change the mobile market for years to come? One thing is for sure though, it&#8217;s re-instilled my faith in Microsoft in the mobile market. We&#8217;ll see how things really are when &#8220;Holiday 2010&#8243; rolls around.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=235</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe AIR Coming to Smartphones</title>
		<link>http://xposuredesign.net/?p=231</link>
		<comments>http://xposuredesign.net/?p=231#comments</comments>
		<pubDate>Tue, 16 Feb 2010 03:40:27 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[2.0]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[smartphones]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=231</guid>
		<description><![CDATA[In a recent press release, Adobe has announced that they will be releasing the adobe AIR platform to mobile devices, including Android, Windows Mobile, and the iPhone as part of the Open Screen Project. No release date has been set for the runtimes. The Adobe AIR 2.0 beta SDK has been released and is available]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="AIR Logo" src="http://www.chrisschnyder.com/wp-content/uploads/2009/04/adobe-air-icon.png" alt="" width="102" height="100" />In a recent press release, Adobe has announced that they will be releasing the adobe AIR platform to mobile devices, including Android, Windows Mobile, and the iPhone as part of the Open Screen Project. No release date has been set for the runtimes.</p>
<p>The Adobe AIR 2.0 beta SDK has been released and is available for download. It includes a handful of new features including multi-touch and gesture support. for downloads and other information, see the<a title="AIR 2 Beta Page" href="http://labs.adobe.com/technologies/air2/" target="_blank"> Adobe Labs page</a>.</p>
<p>Just another reason to love being a Flex Developer.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=231</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Downtime</title>
		<link>http://xposuredesign.net/?p=199</link>
		<comments>http://xposuredesign.net/?p=199#comments</comments>
		<pubDate>Tue, 26 Jan 2010 03:29:49 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[downtime]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=199</guid>
		<description><![CDATA[Sorry If I inconvenienced anyone, somehow my server got unplugged and I didn&#8217;t notice.]]></description>
			<content:encoded><![CDATA[<p>Sorry If I inconvenienced anyone, somehow my server got unplugged and I didn&#8217;t notice.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=199</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clicking Through a Sprite in Flex/Actionscript</title>
		<link>http://xposuredesign.net/?p=194</link>
		<comments>http://xposuredesign.net/?p=194#comments</comments>
		<pubDate>Mon, 18 Jan 2010 22:36:16 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[through]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=194</guid>
		<description><![CDATA[I ran into a problem recently where I wanted to add a rectangle to the stage but still wanted users to be able to click through it. Here&#8217;s a solution I found: private function addClickThroughSprite():void { overlay = new Sprite(); overlay.graphics.beginFill(0xFF0000,0.2); overlay.graphics.drawRect(0,0,width,height); overlay.graphics.endFill(); overlay.hitArea = new Sprite(); rawChildren.addChild(overlay); } Basically you set the sprite hit]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem recently where I wanted to add a rectangle to the stage but still wanted users to be able to click through it. Here&#8217;s a solution I found:</p>
<pre class="brush: as3; highlight: [7];">
private function addClickThroughSprite():void
	{
	overlay = new Sprite();
	overlay.graphics.beginFill(0xFF0000,0.2);
	overlay.graphics.drawRect(0,0,width,height);
	overlay.graphics.endFill();
	overlay.hitArea = new Sprite();
	rawChildren.addChild(overlay);
	}
</pre>
<p>Basically you set the sprite hit area to a blank sprite, which exposes the components beneath. If anyone has a better solution feel free to share it.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=194</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integer Division In Flex/Actionscript</title>
		<link>http://xposuredesign.net/?p=189</link>
		<comments>http://xposuredesign.net/?p=189#comments</comments>
		<pubDate>Mon, 18 Jan 2010 18:37:48 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[decimal]]></category>
		<category><![CDATA[division]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[integer]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=189</guid>
		<description><![CDATA[If you&#8217;re used to C and other elemental high level programming languages, you know that 5÷9 = 0 and 10÷7 = 1. ActionScript being higher level than C automatically coerces the quotient of two numbers to the Number class, producing a decimal. To get the correct integer quotient, use the Math.floor function, which drops the]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re used to C and other elemental high level programming languages, you know that 5÷9 = 0 and 10÷7 = 1. ActionScript being higher level than C automatically coerces the quotient of two numbers to the <em>Number</em> class, producing a decimal. To get the correct integer quotient, use the <em>Math.floor </em>function, which drops the decimal.</p>
<pre class="brush: as3;">
//This produces 4
var integer:int = Math.floor(14/3);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=189</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to Try/Catch in Flex/Actionscript</title>
		<link>http://xposuredesign.net/?p=88</link>
		<comments>http://xposuredesign.net/?p=88#comments</comments>
		<pubDate>Fri, 15 Jan 2010 21:23:02 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=88</guid>
		<description><![CDATA[Sometimes when you&#8217;re making a Flex application, you&#8217;ll expect a certain piece of code to fail at some point. This is the job of try and catch. For example, say I wanted to loop over a bunch of components I had within an HBox: &#60;mx:HBox id=&#34;myHBox&#34;&#62; &#60;mx:Panel title=&#34;1&#34;/&#62; &#60;mx:Panel title=&#34;2&#34;/&#62; &#60;mx:Panel title=&#34;3&#34;/&#62; &#60;mx:Panel title=&#34;4&#34;/&#62; &#60;mx:Panel]]></description>
			<content:encoded><![CDATA[<p>Sometimes when you&#8217;re making a Flex application, you&#8217;ll expect a certain piece of code to fail at some point. This is the job of <em>try </em>and <em>catch</em>. For example, say I wanted to loop over a bunch of components I had within an HBox:</p>
<pre class="brush: xml;">
&lt;mx:HBox id=&quot;myHBox&quot;&gt;
		&lt;mx:Panel title=&quot;1&quot;/&gt;
		&lt;mx:Panel title=&quot;2&quot;/&gt;
		&lt;mx:Panel title=&quot;3&quot;/&gt;
		&lt;mx:Panel title=&quot;4&quot;/&gt;
		&lt;mx:Panel title=&quot;5&quot;/&gt;
		&lt;mx:Panel title=&quot;6&quot;/&gt;
		&lt;mx:Panel title=&quot;7&quot;/&gt;
&lt;/mx:HBox&gt;
</pre>
<p>To loop over these panels without setting a specific <em>id</em> for each, we can use the <em>DisplayObject</em>&#8216;s <em>getChildAt()</em> function. So within the <mx:Script> block I could make a function that does the following:</p>
<pre class="brush: as3;">
private function averageTitles(box:HBox):Number
				{
				// initialize some variables
				var tempTotal:int = 0;
				var i:int = 0;
				var length:int = 0;
				var isEnd:Boolean = false;
				var tempPanel:Panel;
				//loop until the isEnd variable is true
				while(!isEnd)
					{
					//Try to get the child at location i
					try
						{
						tempPanel = box.getChildAt(i);
						tempTotal += parseInt(tempPanel.title);
						i++;
						}
					//if it fails, we have reached the end of the panels
					catch(e:Error)
						{
						isEnd = true;
						}
					//we always want to increase the length,
					//since the length is longer than the index
					finally
						{
						length++;
						}
					}
				//return the average
				return tempTotal / length;
				}
</pre>
<p>(Obviously the <em>length</em> is unnecessary, Its just an example)</p>
<p>The <em>try </em>block is what the program will attempt to execute first, and the code you expect to fail. In this example, the <em>myHBox.getChildAt(i)</em> is undoubtedly going to fail at some point when the <em>HBox </em>runs out of panels. When this happens, the program will throw an error, more specifically a <em>RangeError</em>, meaning you&#8217;re attempting to access something outside the array&#8217;s bounds. The <em>catch</em> block will quite literally &#8220;catch&#8221; the error before it escapes to the main application and causes a runtime error(the window that pops up when something goes wrong in a flash movie in your browser). The <em>catch </em>block will then execute the code within its block. A <em>catch </em>block can catch many kinds of errors; in my example I use the error type <em>Error</em>, meaning it will catch all errors. Since I know what kind of error will occur in my code, I could have just as easily written:</p>
<pre class="brush: as3;">
catch(e:RangeError)
	{
	isEnd = true;
	}
</pre>
<p>And the effect would be the same. You can also catch multiple types of errors within a <em>try </em>block using multiple <em>catch </em>statements where appropriate.</p>
<p>For a list of all types of errors, look at the <strong>Subclasses</strong> of the Error class in the <a href="http://livedocs.adobe.com/flex/3/langref/Error.html">Adobe Flex Language Reference</a>.</p>
<p>You may also have noticed the <em>finally</em> block which increments the var <em>length</em>. The <em>finally</em> block is used to execute code regardless of when an error happens. So in the <em>finally </em>block in my code:</p>
<pre class="brush: as3;">
finally
	{
	length++;
	}
</pre>
<p>The length will always be incremented if there is an error or not, as we need the total number of items to find the average.</p>
<p>That&#8217;s basically it, I&#8217;ll write a more advanced tutorial later on things like throwing new errors and such. Good luck in your coding endeavors.</p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=88</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Black SMS-Chat Skin for Windows Mobile</title>
		<link>http://xposuredesign.net/?p=169</link>
		<comments>http://xposuredesign.net/?p=169#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:58:16 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[sms-chat]]></category>
		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://xposuredesign.net/?p=169</guid>
		<description><![CDATA[For those of you who use the new SMS Chat for Windows Mobile, I created a new skin to replace the crappy black one that comes as the default. It works with SMS-Chat 1.25, so upgrade if you don&#8217;t have the latest version. Unfortunately the developers hard coded in a lot of color information so]]></description>
			<content:encoded><![CDATA[<p>For those of you who use the new SMS Chat for Windows Mobile, I created a new skin to replace the crappy black one that comes as the default. It works with SMS-Chat 1.25, so upgrade if you don&#8217;t have the latest version.</p>
<p><img class="aligncenter size-full wp-image-174" title="screens" src="http://xposuredesign.net/wp-content/uploads/2010/01/screens.jpg" alt="" width="720" height="320" /></p>
<p>Unfortunately the developers hard coded in a lot of color information so we&#8217;re stuck with the blue for now(I&#8217;d rather have it as a green). Just download the <em>black.bmp</em> and<em> black_alert.bmp</em> files and copy them to<em> /Program Files/VITO/SMS-Chat/skins/bin </em>directory and overwrite the existing ones. Hope you enjoy!</p>
<p><a href="http://xposuredesign.net/wp-content/uploads/2010/01/black_alert.bmp"></a><a href="http://xposuredesign.net/wp-content/uploads/2010/01/black.bmp"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://xposuredesign.net/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
