<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Code of Doom</title>
	
	<link>http://codeofdoom.com/wordpress</link>
	<description />
	<lastBuildDate>Mon, 15 Aug 2011 00:50:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CodeOfDoom" /><feedburner:info uri="codeofdoom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Overlooking autosize in Texture Packer</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/vKqQwUfncRo/</link>
		<comments>http://codeofdoom.com/wordpress/2011/08/14/overlooking-autosize-in-texture-packer/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 00:50:02 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[texture packer]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=558</guid>
		<description><![CDATA[So I&#8217;ve been using TexturePacker recently for my iphone game. It is a great tool and I would recommend it to everyone. However, I did run into an issue. I took a break from coding my game for about 6 months and recently got back into it. Since then, a new version of texture packer [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been using <a href="http://www.texturepacker.com" title="Texture Packer" target="_blank">TexturePacker</a> recently for my iphone game. It is a great tool and I would recommend it to everyone. However, I did run into an issue. </p>
<p>I took a break from coding my game for about 6 months and recently got back into it. Since then, a new version of texture packer was released. Everything seemed the same, but then I noticed that no matter what I did with anything made with the new version, my app would just crash with a SIGABRT error. No good. The code would work fine with the older spritesheets that was made in the past, but nothing new.<br />
<span id="more-558"></span></p>
<p>After posting on the cocos2d forums, one of the developers for Texture Packer actually helped me out. It turns out using Autosize will make your textures/spritesheets not be the power of 2, which they all have to be. With this, it will just throw the error and you have no clue why.</p>
<p>Look out for that little error! In Texture Packer, you may be enticed to use it since it cuts down on the size. However, it may throw you into a tailspin. After emailing the developer, I asked why would you have this option and this was his response:</p>
<blockquote><p>
You can enable NPOT (non power of two) for newer devices in the cocos2d settings.<br />
Should work on iPads and iPhone4. I think it&#8217;s new in cocos2d 1.x
</p></blockquote>
<p>I guess you can use it, but you just have to be careful in what scenarios you use it in. Also, if you are looking for a tool to help with managing your sprite sheets, I definitely recommend purchasing <a href="http://www.texturepacker.com" title="Texture Packer" target="_blank">Texture Packer</a>. There is also an evaluation version you can use to make sure it will do everything you need. </p>
<p>Hope that helps if anyone runs into this problem!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/vKqQwUfncRo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2011/08/14/overlooking-autosize-in-texture-packer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2011/08/14/overlooking-autosize-in-texture-packer/</feedburner:origLink></item>
		<item>
		<title>And I’ve made the jump…</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/ymjcqy-jtR4/</link>
		<comments>http://codeofdoom.com/wordpress/2011/01/12/and-ive-made-the-jump/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 15:41:35 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=555</guid>
		<description><![CDATA[There is no denying that I really enjoy mobile dev. Time has not exactly been on my side in terms of it, but you cant say that the future is not in mobile devices (See the over 100 tablets at the recent CES event). And as much as I loved making my games for the [...]]]></description>
			<content:encoded><![CDATA[<p>There is no denying that I really enjoy mobile dev. Time has not exactly been on my side in terms of it, but you cant say that the future is not in mobile devices (See the over 100 tablets at the recent CES event). And as much as I loved making my games for the palm pre, I cant help but be frustrated by a few key factors.</p>
<p>One, I do not like the developer tools. A lot of it has a rushed feeling to it and just does not give a solid feeling. If you want to make  apps, use the unstable eclipse plug in&#8230;. or Ares&#8230; why not. If you want to make games using the PDK, use visual studio in windows or xcode on a mac. On top of that, there is a whole other SDK coming out to replace mojo. All of this makes it difficult to 1. easily develop apps or 2. Have a mature development community. It&#8217;s pretty annoying to run into a problem and not have anyone run into the same problem and no one really there to help out.</p>
<p>This being said, I have decided too make the jump to doing iPhone games. I know the market is already flooded with games for the iPhone, but with the matured community and tons of existing and proven frameworks, it is something I have enjoyed thus far. It has been a bit of a learning curve for me considering I havent done any objective C programming, but I am slowly learning. </p>
<p>Anyways, I want to try to keep up a daily blog of my learnings, goals for my game, etc. </p>
<p>Looking forward to more posts!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/ymjcqy-jtR4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2011/01/12/and-ive-made-the-jump/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2011/01/12/and-ive-made-the-jump/</feedburner:origLink></item>
		<item>
		<title>Word Jumble now available on the Palm App Catalog</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/b4wqxDjnGdA/</link>
		<comments>http://codeofdoom.com/wordpress/2010/05/25/word-jumble-now-available-on-the-palm-app-catalog/#comments</comments>
		<pubDate>Tue, 25 May 2010 19:12:29 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Palm Pre]]></category>
		<category><![CDATA[Random Notes]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/2010/05/25/word-jumble-now-available-on-the-palm-app-catalog/</guid>
		<description><![CDATA[Word Jumble has now been released on the Palm App Catalog for both the Palm Pre and the Pixi. It definitely took a lot longer than I anticipated but the end result is a great looking and polished product. From the product description Word Jumble is a great and addictive game that will keep you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.palm.com/webChannel/index.php?packageid=com.codeofdoom.wordjumble"> Word Jumble</a> has now been released on the Palm App Catalog for both the Palm Pre and the Pixi. It definitely took a lot longer than I anticipated but the end result is a great looking and polished product. </p>
<p>From the product description<br />
<i><br />
Word Jumble is a great and addictive game that will keep you coming back for more! Unscramble the jumbled words to reveal the secret keyword at the bottom. Over 5200+ possible words! Play against the clock or at your leisure. Think its too easy? You have 3 different times to test yourself against. Not sure what a word is? Use the hint feature to give you a hand. High scores for both Timed and Normal games!</p>
<p></i></p>
<p>Please feel free to leave some feedback, good or bad. </p>
<p>Thanks!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/b4wqxDjnGdA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2010/05/25/word-jumble-now-available-on-the-palm-app-catalog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2010/05/25/word-jumble-now-available-on-the-palm-app-catalog/</feedburner:origLink></item>
		<item>
		<title>Five or More released!</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/dcEqygHVP28/</link>
		<comments>http://codeofdoom.com/wordpress/2010/04/20/five-or-more-released/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 13:47:02 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=545</guid>
		<description><![CDATA[Five of more is released! Well that didnt take too long. I would like to do a few more updates (difficulty level settings, global high scores, etc) so hopefully that wont take too long to get those updates out the door. If you experience any problems with it, please email me at marcel@codeofdoom.com Thanks!]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.palm.com/webChannel/index.php?packageid=com.codeofdoom.app.fiveormore">Five of more is released!</a></p>
<p>Well that didnt take too long. I would like to do a few more updates (difficulty level settings, global high scores, etc) so hopefully that wont take too long to get those updates out the door. If you experience any problems with it, please email me at <a href="mailto:marcel@codeofdoom.com">marcel@codeofdoom.com</a></p>
<p>Thanks!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/dcEqygHVP28" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2010/04/20/five-or-more-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2010/04/20/five-or-more-released/</feedburner:origLink></item>
		<item>
		<title>Five or More finally submitted to the palm app catalog!</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/127L4o_Byls/</link>
		<comments>http://codeofdoom.com/wordpress/2010/04/17/five-or-more-finally-submitted-to-the-palm-app-catalog/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 00:23:09 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Palm Pre]]></category>
		<category><![CDATA[Random Notes]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=542</guid>
		<description><![CDATA[I know I have been slacking on this (amongst other things like maintenance of the site) but I have finally gotten around to wrapping up my game that I made awhile ago for the Palm Pre. There were a few tweaks made to the game that some people were concerned with, so hopefully a lot [...]]]></description>
			<content:encoded><![CDATA[<p>I know I have been slacking on this (amongst other things like maintenance of the site) but I have finally gotten around to wrapping up my game that I made awhile ago for the Palm Pre. There were a few tweaks made to the game that some people were concerned with, so hopefully a lot more people will enjoy it.</p>
<p>I would like to add difficulty levels to the game in the future, as well as a &#8216;continue&#8217; feature. </p>
<p>I will keep you posted once the app is approved or not.</p>
<p>Cya then!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/127L4o_Byls" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2010/04/17/five-or-more-finally-submitted-to-the-palm-app-catalog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2010/04/17/five-or-more-finally-submitted-to-the-palm-app-catalog/</feedburner:origLink></item>
		<item>
		<title>More Pre game updates.</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/ZkOXbkdYxew/</link>
		<comments>http://codeofdoom.com/wordpress/2009/07/30/more-pre-game-updates/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 19:28:16 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Palm Pre]]></category>
		<category><![CDATA[Random Notes]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=538</guid>
		<description><![CDATA[I have been hard at work (in my spare time at least harr) working on updating 5 or more to get it into a much more playable state. I think I am down to 2 more bugs. One is a big pain in the ass and the other isnt too bad. Sometimes if you are [...]]]></description>
			<content:encoded><![CDATA[<p>I have been hard at work (in my spare time at least harr) working on updating 5 or more to get it into a much more playable state. I think I am down to 2 more bugs. One is a big pain in the ass and the other isnt too bad. Sometimes if you are able to fill the whole board and you get a 5 in a row RIGHT at the last second, it will go to gameover. I know what is wrong, I just havent fixed it yet. </p>
<p>The reason I haven&#8217;t  is that I decided to get my mind off of it by making another Pre game. This one is much more recognizable, which is Simon. Yep, that game that you played with you were like 8, with the 4 buttons and you have to repeat the pattern. Anyways, it is in version 0.5.04 at the moment. I still have some things to work on it though. The pre does not seem to handle audio very well though. Almost as if it is a delicate flower. <sigh> </p>
<p>Anyways, if you want to check out the updated game and simon, here you go!<br />
<a href="http://www.codeofdoom.com/webos/com.codeofdoom.simon_0.5.04_all.ipk">Simon v0.5.04</a><br />
<a href="http://www.codeofdoom.com/webos/com.codeofdoom.app.fiveormore_0.7.25_all.ipk">Five or More v.0.7.25</a></p>
<p>Also, I do plan on doing some WebOs tutorials in a bit, so stay turned!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/ZkOXbkdYxew" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2009/07/30/more-pre-game-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2009/07/30/more-pre-game-updates/</feedburner:origLink></item>
		<item>
		<title>Palm Pre Game: 5 or More v 0.6.01</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/gJXofjx9tCk/</link>
		<comments>http://codeofdoom.com/wordpress/2009/07/19/palm-pre-game-5-or-more-v-0601/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 05:50:19 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=536</guid>
		<description><![CDATA[Ive got an update to the game. Not too many visual changes. There was a bug where the buttons werent showing the text that was fixed. I have fixed PART of a path finding bug, only to find out there were two issues with it. I may have to just rewrite the path finding function. [...]]]></description>
			<content:encoded><![CDATA[<p>Ive got an update to the game. Not too many visual changes. There was a bug where the buttons werent showing the text that was fixed. I have fixed PART of a path finding bug, only to find out there were two issues with it. I may have to just rewrite the path finding function. oh well.</p>
<p>I also fixed an &#8216;undo exploit&#8217; where you could keep undoing and waiting for the right piece to drop in the right spot. </p>
<p>Anyways, feel free get the <a href="http://www.codeofdoom.com/fiveormore/com.codeofdoom.app.fiveormore_0.6.01_all.ipk">updated version</a></p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/gJXofjx9tCk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2009/07/19/palm-pre-game-5-or-more-v-0601/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2009/07/19/palm-pre-game-5-or-more-v-0601/</feedburner:origLink></item>
		<item>
		<title>Palm Pre Game: 5 or More v 0.5.0</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/b-QlG8Cd5HU/</link>
		<comments>http://codeofdoom.com/wordpress/2009/07/17/palm-pre-game-5-or-more-v-050/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 20:44:30 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Palm Pre]]></category>
		<category><![CDATA[Add new tag]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=524</guid>
		<description><![CDATA[So I have gotten my first Palm Pre game in a playable state, sans one bug that I am currently working on. The game is called 5 or more and I have included the rules and how to play with the game (under the help menu). You will need to have your pre in developer [...]]]></description>
			<content:encoded><![CDATA[<p>So I have gotten my first Palm Pre game in a playable state, sans one bug that I am currently working on. The game is called 5 or more and I have included the rules and how to play with the game (under the help menu). You will need to have your pre in developer mode in order to install it (note this is different from having to root your pre) and use this application to get the game onto your phone:</p>
<p><a href="http://predev.wikidot.com/installing-apps-on-a-stock-pre-post-1-04-update">http://predev.wikidot.com/installing-apps-on-a-stock-pre-post-1-04-update</a></p>
<p>And here is the game:<br />
<a href="http://www.codeofdoom.com/fiveormore/com.codeofdoom.app.fiveormore_0.5.0_all.ipk">http://www.codeofdoom.com/fiveormore/com.codeofdoom.app.fiveormore_0.5.0_all.ipk</a></p>
<p>Some screen shots:<br />
<a href="http://www.codeofdoom.com/fiveormore/gameplay.jpg">Screenshot 1</a><br />
<a href="http://www.codeofdoom.com/fiveormore/gameplay2.jpg">Screenshot 2</a><br />
<a href="http://www.codeofdoom.com/fiveormore/gameover.jpg">Screenshot 3</a><br />
<a href="http://www.codeofdoom.com/fiveormore/highscore.jpg">Screenshot 4</a><br />
<a href="http://www.codeofdoom.com/fiveormore/menu.jpg">Screenshot 5</a></p>
<p>Things on the todo list:</p>
<ul>
<li> fix bug that doesnt let you move a piece to a certain spot </li>
<li> Sound (sound from moving. maybe ambient music while playing?</li>
<li> Add a background</li>
<li> Add &#8220;special pieces&#8221; </li>
<li> Add achievements </li>
<li> Change the scoring around a little bit</li>
<p>Of course, if anyone wants to give any feed back on the gameplay, let me know. I also already want to rewrite this app. This definitely started with something where I was learning javascript, but definitely not applying best practices. Soon I will be picking up a few books to help out with that. I do have a few other ideas for games to create, so keep an eye out <img src='http://codeofdoom.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>ps<br />
Although I am sure many of you have heard, Palm made the SDK publicly available. So feel free to <a href="http://developer.palm.com">check it out.</a></p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/b-QlG8Cd5HU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2009/07/17/palm-pre-game-5-or-more-v-050/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2009/07/17/palm-pre-game-5-or-more-v-050/</feedburner:origLink></item>
		<item>
		<title>So where have I been?</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/bLHlz_YiJHA/</link>
		<comments>http://codeofdoom.com/wordpress/2009/07/09/so-where-have-i-been/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:46:52 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Random Notes]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=520</guid>
		<description><![CDATA[Any regular readers of this blog probably took not that I went from posting one of two things here a week to posting nothing for about two months. Maybe I cursed myself by writing the article Why do our time estimates suck, because I am finally wrapping up a project where the estimations just went [...]]]></description>
			<content:encoded><![CDATA[<p>Any regular readers of this blog probably took not that I went from posting one of two things here a week to posting nothing for about two months. Maybe I cursed myself by writing the article <a href="http://codeofdoom.com/wordpress/2009/04/19/why-do-our-time-estimates-suck/">Why do our time estimates suck</a>, because I am finally wrapping up a project where the estimations just went down the crapper. I did learn another lesson though about why estimations suck, and that is being on a project that its entire life cycle (IE, planning, development, testing, regression testing, etc) is a massive discovery phase. </p>
<p>This basically boiled down to those who were in charge of pulling the data down were not aware that what the client was asking was either a)something different or b) next to impossible given the dataset. No one knew it at the time, so everyone just found out as the project progressed. Luckily the blame of that was not on our plate, but it did affect our ability to get the job done in a sane manner. However, the project is &#8220;done&#8221;, so hopefully my schedule will go back to something more reasonable and I will be able to contribute more. </p>
<p>In the mean time, I did end up picking up a palm pre and actually got invited into their pre SDK development program. I have been messing with that and I have started working on a game called 5 or more. The gray pieces are &#8220;open spots&#8221; where you can move the colored pieces to. You have to have a clear path of open pieces when you move a piece from one place to another. Each time you move a piece, 3 more pieces will drop. Once you line up 5 or more of the same color, they will change into open (gray) pieces. Here are some pics of it so far:</p>
<p><a href="http://www.codeofdoom.com/game.jpg">5 or more picture 1</a><br />
<a href="http://www.codeofdoom.com/game2.jpg">5 or more picture 2</a></p>
<p>Its pretty close to being completed. Once it is completed, I will be submitting it to the app catalog, so hopefully I will be able to be part of the initial wave of new apps <img src='http://codeofdoom.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
<p>In the future, I would like to start posting articles about developing for the pre, but I would like to get some more experience with it first. </p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/bLHlz_YiJHA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2009/07/09/so-where-have-i-been/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2009/07/09/so-where-have-i-been/</feedburner:origLink></item>
		<item>
		<title>Know your Flex interfaces</title>
		<link>http://feedproxy.google.com/~r/CodeOfDoom/~3/4gMFxOaTruY/</link>
		<comments>http://codeofdoom.com/wordpress/2009/05/18/know-your-flex-interfaces/#comments</comments>
		<pubDate>Tue, 19 May 2009 02:49:37 +0000</pubDate>
		<dc:creator>Marcel</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Learn This]]></category>
		<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://codeofdoom.com/wordpress/?p=501</guid>
		<description><![CDATA[One of the things I love about Flex is how extensible it can be. You are able to make composite components to do almost anything you want using out of the box components. However, if you really want to take advantage of its power, it helps to have a good or in depth knowing of [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I love about Flex is how extensible it can be. You are able to make composite components to do almost anything you want using out of the box components. However, if you really want to take advantage of its power, it helps to have a good or in depth knowing of the interfaces that come with it. The reason to proclaim the importance is that using these interfaces, you will be able to create extremely light weight components, but you will be able to make them do whatever you want (in a programming sense of the phrase).</p>
<p>There are, of course, <a href="http://www.mikechambers.com/blog/2008/02/29/actionscript-3-class-interface-implementations/ " target="_blank">quite a few</a> different interfaces. I have looked through them and picked out five interfaces that I consider to be the more important ones. For each, I will give a brief explanation of why they are important and where you would normally use them.<br />
<span id="more-501"></span><br />
<strong>IListItemRenderer</strong><br />
Usually when creating composite components or item renderers, I try to stick with UIComponent rather than something like an HBox or Canvas. If you are going to use it item renderer for something like a list though, you are going to have to implement IListItemRenderer to your UIComponent. Keep in mind, if you dont use an UIComponent, there are a lot of other interfaces you will have to implement. If you want to keep it simple, use UIComponent.</p>
<p>When you implement IListItemRenderer, you are given access to the listData, which has one extremely useful property on it. Using the listData property, you will be able to tell in your item renderer which field of your dataprovider you are currently using. This property is know as the labelField. This is useful when you need to handle special cases for different properties. Since you have a access to this, you can setup something like a property map to handle each case.</p>
<p>When implementing the IListItemRenderer, when setting your getter/setter for your listData, keep in mind that the data coming in will be of type BaseListData. Be sure that your classes implementing this will have that property on it. </p>
<p><strong>IDropInListItemRenderer<br />
</strong>As you might have noticed, I did say to use the IListItemRenderer for lists. Well what about grids? With a IDropInListItemRenderer, you are able to reuse the renderer to assign it to multiple properties, for say, columns in a datagrid. Keep in mind that when using the IDropInListItemRenderer, you must also implement IDataRenderer(which I will discuss shortly). This is in order to have access to the data property. The listData is then used to initialize the data property. Normally when your components need to apply new listData, it takes place in the commitProperties (or in invalidateProperties is flagged. However you feel like describing it). When you implement your getter for listData, make sure you bind a dataChange event in your component like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"> <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;dataChange&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> listData<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>BaseListData<span style="color: #000000;">&#123;</span>
      <span style="color: #0033ff; font-weight: bold;">return</span> _listData;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This will ensure that your getters/setters are called properly. This also applies to IListItemRenderer. You will also notice that the BaseListData object is also used whenever you are using IDropInListItemRenderer. This is because the type that is actually used is dependant on the component that it is being used with. If it is a grid, it will use DataGridListData, Lists will use ListData and a Tree control will use TreeListData.</p>
<p><strong>IDataRenderer</strong><br />
The IDataRenderer is another popular one amongst item renderers. This is what gives you access to the data property. Along with needing to work with the listDataRenderers, it is also used whenever a chart needs a renderer. It could also be used with datagrids as well, but for this, the data property would be the data for the entire row, not specifically for the item. Just like in our IDropInListItemRenderer, we need  to make sure  that our component has a binding for the dataChange event. The other important fact for this is that when you are setting your data, to fully complete the binding, an event dataChange event must be fired.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
  _data = <span style="color: #004993;">value</span>;    
  <span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> FlexEvent<span style="color: #000000;">&#40;</span>FlexEvent.DATA_CHANGE<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><strong>IEventDispatcher</strong><br />
This is one of the more interesting interfaces. Not so much because its cool or does anything special, but it is the only interface where it is recommended to either:</p>
<p>a) extend EventDispatcher<br />
or<br />
b) if that&#8217;s not an option, have an IEventDispatcher property on your component.</p>
<p>Personally, I pick option B. If you have a property for it, it does give you the ability to assign a different implementation class to it, making it more versatile. You could leave it as a normal EventDispatcher, but you could also assign a CairngormEventDispatcher to it. Once you do this, you will be able to create your own hooks in order to dispatch your events.</p>
<p><strong>IResponder</strong><br />
I feel this gets overlooked but it is definitely important in the world of data services. The reason it gets overlooked is that we just often copy/paste code like this and take it for granted that there will always be a result function for our service calls. However, this is the interface that gives us access to our result and fault functions that our asynchronous service calls make. Most of the time, we use existing frameworks such as cairngorm or puremvc for this, but it is good to have an idea of what is going on the background.</p>
<p>Usually our fault function looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> fault<span style="color: #000000;">&#40;</span><span style="color: #004993;">info</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Normally a FaultEvent is what is returned, but according to the Flex documents, this is not always the face, hence it being returned as an object.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> result<span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Once again,  this normally comes back as a ResultEvent, but this is not always the case.</p>
<p>These are just a few of the major interfaces that I have used more often than not. There are quite a bit more. While knowing all of them by heart is not something I would consider necessary, but when you start creating custom components, knowing these interfaces and how to use them are extremely important. It allows you to create more flexible, clean and light weight components. </p>
<p>Think I left something out? Any other important ones? Wrong about something? Feel free to comment!</p>
<img src="http://feeds.feedburner.com/~r/CodeOfDoom/~4/4gMFxOaTruY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codeofdoom.com/wordpress/2009/05/18/know-your-flex-interfaces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://codeofdoom.com/wordpress/2009/05/18/know-your-flex-interfaces/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.811 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-03 07:34:48 -->
