<?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>mclelun &#187; Scripting and Coding</title>
	<atom:link href="http://www.mclelun.com/blog/category/scripting-and-coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mclelun.com/blog</link>
	<description>Design + Programming = Multitask</description>
	<lastBuildDate>Thu, 26 Aug 2010 15:00:42 +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>FlashDevelop and Flex</title>
		<link>http://www.mclelun.com/blog/2010/06/flashdevelop-and-flex/</link>
		<comments>http://www.mclelun.com/blog/2010/06/flashdevelop-and-flex/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 17:29:42 +0000</pubDate>
		<dc:creator>mclelun</dc:creator>
				<category><![CDATA[Scripting and Coding]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.mclelun.com/blog/?p=35</guid>
		<description><![CDATA[I wrote about how to setup FlashDevelop with Flex Framework last time, but all my old blog entries are taken down when I revamp this site. So, this is just a reblog of the old entry with some minor changes. Hopefully it will be easier to follow this time. Introduction FlashDevelop is an open source [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mclelun.com/img/blog/100630_flex_h.gif" alt="" /></p>
<p>I wrote about how to setup FlashDevelop with Flex Framework last time, but all my old blog entries are taken down when I revamp this site. So, this is just a reblog of the old entry with some minor changes. Hopefully it will be easier to follow this time.</p>
<p><span id="more-35"></span></p>
<h3>Introduction</h3>
<p>FlashDevelop is an open source script editor which primary use for editing ActionScript (Can be use for XML, HTML, CSS… etc as well). Flex is a free open source framework use for compiling Flash SWF. Both of them are free and open source, so it is good for those who want to learn ActionScript without purchasing Adobe Flash.</p>
<h3>Steps to Setup</h3>
<p>Below is a brief steps on how to setup FlashDevelop with Flex Framework.</p>
<ul>
<li>Download and install <a href="http://www.java.com/en/download/">Java runtime</a>.</li>
<li>Download and install <a href="http://www.flashdevelop.org/community/viewforum.php?f=11">FlashDevelop</a>.</li>
<li>Download and extract <a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4">Flex SDK</a>.</li>
<li>Launch FlashDevelop.</li>
<li>Go to <strong>Tools&gt;Program Settings&gt;AS3 Context&gt;Flex SDK Location</strong>. Fill in the location where you extract flex SDK.</li>
<li>Go to<strong> Tools&gt;Program Settings&gt;Flash Viewer&gt;External Player Path</strong>. Fill in the location of the debug Flash player 10. It is include in the flex SDK package in this location <strong>\runtimes\player\10\win.</strong></li>
<li>Done. You can compile flash10 stuff now. Just create a new project, and edit the Main.as in the src folder</li>
</ul>
<h3>Different Flex Framework Version</h3>
<p>You can use different version of Flex Framework for different projects. Just set a custom path in the project properties at</p>
<ul>
<li><strong>Project&gt;Properties&gt;Compiler Options&gt;Custom Path to Flex SDK</strong></li>
</ul>
<p>This will be useful to test if your project got screw with a new Flex SDK release without affecting other projects.</p>
<h3>Using Preloader</h3>
<p>If you want a preloader in your AS3 project, just start a new project and choose &#8220;<strong>AS3 Project with Preloader</strong>&#8220;. You will want to add in your own script inside the &#8220;<strong>progress</strong>&#8221; function. You can check how many percents of content are loaded by using the following script.</p>
<p><code>percent = e.bytesLoaded / e.bytesTotal * 100</code></p>
<h3>Free Adobe Flash Builder 4 Standard</h3>
<p>Actually Adobe is providing free copies of Flash Builder 4 Standard to students, event attendees, and people who are jobless now. You can get your copy in this <a href="http://www.adobe.com/devnet/flex/free/">page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mclelun.com/blog/2010/06/flashdevelop-and-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Life&#8217;s a Game: Live Borderless</title>
		<link>http://www.mclelun.com/blog/2010/04/lifes-a-game-live-borderless/</link>
		<comments>http://www.mclelun.com/blog/2010/04/lifes-a-game-live-borderless/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 18:45:19 +0000</pubDate>
		<dc:creator>mclelun</dc:creator>
				<category><![CDATA[Art and Design]]></category>
		<category><![CDATA[Scripting and Coding]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Pixel]]></category>

		<guid isPermaLink="false">http://www.mclelun.com/blog/2010/04/lifes-a-game-live-borderless/</guid>
		<description><![CDATA[LG Malaysia is hosting a web based casual game development contest two months ago. I was thinking to participate but was always hold back by office works. I never did anything major until one of my friend message me. Ben, a game designer asked me about the progress on my game. I told him my [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mclelun.com/img/blog/100405_lggame_h.gif" alt="Life's a Game" /></p>
<p>LG Malaysia is hosting a web based casual game development contest two months ago. I was thinking to participate but was always hold back by office works. I never did anything major until one of my friend message me.</p>
<p><span id="more-20"></span></p>
<p>Ben, a game designer asked me about the progress on my game. I told him my situation and we decide to join forces for this project. We also manage to grab another friend, Adrian (game designer) to the team.</p>
<p>Everything seems to be good after the team is build but there is only one minor problem. We start late and just have like two weeks to work on the game before deadline. So, we meet up on one Sunday afternoon to brainstorm about game design, art styles and lock down all major decisions. After that, all communications were done online via messenger, and emails.</p>
<h3>Game Introduction</h3>
<p>Our game is known as &#8220;Life&#8217;s a Game: Live Borderless&#8221;, which is designed based on LG&#8217;s &#8220;Life&#8217;s Good&#8221; tagline.  It is a mash-up of quick &#038; whimsical mini-games depicting everyday life. On a side note, we only have this game title on the last day before submission.</p>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_01.gif" alt="Life's a Game" /></p>
<h3>Pixel Art</h3>
<p>One of the issues while developing this game is deciding the art direction . Three of us in the team have different art style. If I forced both of my friends to follow my art style, I think the final work would not look good, as different people have different drawing stroke. So, we decide to go for pixel art since it is easier to imitate each other work in pixel art. More over, pixel art give a nostalgia feel of old console games.</p>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_02.gif" alt="Life's a Game" /></p>
<h3>Game Play</h3>
<p>When I first read about this competition, the first idea that came into my mind is to develop a game base on  LG&#8217;s &#8220;Life&#8217;s Good&#8221; tagline. And the most obvious way is to develop a game base on everyday life. Ideally, we want to have lots of mini games base on daily life activities. But due to time constraint, we lock the number down to 17 mini games/levels in this Flash game. Most of level is quite straight forward and simple in game play. For example, you need to shave your facial hair by clicking left mouse button for the level show in the image below.</p>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_03.gif" alt="Life's a Game" /></p>
<h3>Popular References</h3>
<p>We also include some popular references in certain levels such as Revoltech, Danboard, classic batman &#038; robin. For the level show in the image below, there are Mario and Luigi poster at the wall.</p>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_04.gif" alt="Life's a Game" /></p>
<h3>Easter Eggs</h3>
<p>During final hour of development, we decide to include &#8220;easter egg&#8221; in some of the levels. In our game, &#8220;easter egg&#8221; are just hidden easter eggs. You can collect these eggs by clicking on them and it would trigger a slightly different ending if certain amount of eggs is collected.</p>
<blockquote><p>A virtual Easter egg is an intentional hidden message, in-joke or feature in an object such as a movie, book, CD, DVD, computer program, web page or video game. &#8211; wiki</p></blockquote>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_05.gif" alt="Life's a Game" /></p>
<h3>Wisdom Quotes</h3>
<p>Another thing we decide to put into game during the last minute is the wisdom quotes scene. When the game ends, a wise old owl will tell the player some wisdom quotes from famous people base on their grades. Initially, we were only using quotes from famous real life peoples such as world leaders and politicians. But we found out certain quotes from cartoon characters is quite good as well, so we decide included them too.</p>
<p><img src="http://www.mclelun.com/img/blog/100405_lggame_06.gif" alt="Life's a Game" /></p>
<h3>Play The Game</h3>
<p>You can play the game by visiting the link below. If you love the game, please vote for us. Click on &#8220;Launch Game&#8221; button on that site will open a pop up containing the game. If you didn&#8217;t see anything after clicking the button. It is most likely the browser is blocking the pop up.</p>
<p><a href="http://www.lgborderless.com.my/contest/view.php?gallery_id=16" target="_blank">Life&#8217;s a Game: Live Borderless</a> &#8211; 612KB</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mclelun.com/blog/2010/04/lifes-a-game-live-borderless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactoring Lost</title>
		<link>http://www.mclelun.com/blog/2010/02/refactoring-lost/</link>
		<comments>http://www.mclelun.com/blog/2010/02/refactoring-lost/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 16:21:46 +0000</pubDate>
		<dc:creator>mclelun</dc:creator>
				<category><![CDATA[Art and Design]]></category>
		<category><![CDATA[Scripting and Coding]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Illustration]]></category>

		<guid isPermaLink="false">http://www.mclelun.com/blog/?p=17</guid>
		<description><![CDATA[I didn&#8217;t go to office today and I was staying at home to have some rest. But I don&#8217;t really like to spend my whole day by just sleeping and did nothing. So, I dig up an old Flash project that I had long neglected and continue to work on it. This Flash project is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mclelun.com/lost/" target="_blank"><img src="http://www.mclelun.com/img/blog/100208_as3lost_h.gif" alt="lost"/></a></p>
<p>I didn&#8217;t go to office today and I was staying at home to have some rest. But I don&#8217;t really like to spend my whole day by just sleeping and did nothing. So, I dig up an old Flash project that I had long neglected and continue to work on it.</p>
<p><span id="more-17"></span></p>
<p>This Flash project is actually a conversion of my &#8220;Lost&#8221; Flash from AS2 to AS3. Originally, the AS2 &#8220;Lost&#8221; Flash was based on a wallpaper design that I did for an art event during 2007. One of my friends saw the wallpaper design and told me that the idea could be implement into a simple website. So, I took up the challenge and make it into a simple yet interesting website (at least in my opinion).</p>
<p><a href="http://fc00.deviantart.net/fs23/i/2007/313/1/4/Lost_by_mclelun.jpg" rel="lightbox" title="Doodle: Lost"><img src="http://www.mclelun.com/img/blog/100208_as3lost_00.jpg" title="" alt="" /></a></p>
<p>Not long after I complete the AS2 version of this Flash, I go through the scripting again and saw how ugly the script was. Although the ugly code is not &#8220;visible&#8221; to the end user/visitors of my site, but the extensibility is very bad. It was quite hard to add in new features later on.</p>
<p>Being a person that obsessed with &#8220;clean&#8221; code, I start refactoring the code during 2008. Half way through the process, I realize I might as well completely re-write the script in AS3 OOP. But my AS3 OOP was quite bad back then, so the progress is snail pace and the project got stuck after a while.</p>
<p>Time flies and today is 2010. I finally finish converting this damn thing from AS2 to AS3 after sitting in front of my PC one whole day. Most of the half baked script had been dump and re-written. I also manage to add in a few new features along the way.</p>
<h3>Multiple Objects</h3>
<p>The AS2 version was just one single character. But now I could spawn multiple objects into this &#8220;Lost&#8221; Flash by just changing a parameter, thanks to good use of OOP object class. I could even take this class file and reuse it in another project. I never understand that OOP &#8220;reusability until recently. That&#8217;s the problem with the education system here, the lecturer ask you memorize &#8220;The benefits of OOP programming&#8221;, instead of teaching you how to code in OOP.</p>
<p><img src="http://www.mclelun.com/img/blog/100208_as3lost_01.jpg" alt="lost wallpaper"/></p>
<h3>Updated Guestbook</h3>
<p>I also manage to update the guestbook system. Visitor can now make star constellation when they leave their comments. </p>
<p><img src="http://www.mclelun.com/img/blog/100208_as3lost_02.jpg" alt="lost wallpaper"/></p>
<p>Visit this <a href="http://www.mclelun.com/lost/">page </a>to view the updated version and sign my guestbook. I hope there is no serious bug in this version. =)</p>
<h3>Download</h3>
<p><a href="http://www.mclelun.com/lost/">View the Flash!</a><br />
<a href="http://mclelun.deviantart.com/art/Lost-69432721">Lost Wallpaper 1 Deviant page</a><br />
<a href="http://mclelun.deviantart.com/art/Lost-2-69432888">Lost Wallpaper 2 Deviant page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mclelun.com/blog/2010/02/refactoring-lost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Twitter Update List</title>
		<link>http://www.mclelun.com/blog/2010/01/jquery-twitter-update-list/</link>
		<comments>http://www.mclelun.com/blog/2010/01/jquery-twitter-update-list/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 15:29:06 +0000</pubDate>
		<dc:creator>mclelun</dc:creator>
				<category><![CDATA[Scripting and Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.mclelun.com/blog/?p=12</guid>
		<description><![CDATA[After my first experiment using jQuery to develop a rotating banner, I noticed that the script I wrote could be use for other similar list items such as a Twitter update list. To retrieve recent my tweets, I paste the following JavaScript provided by Twitter into the &#60;body&#62; of my page. &#60;script src="http://twitter.com/javascripts/blogger.js"&#62;&#60;/script&#62; &#60;script src="http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&#38;count=3"&#62;&#60;/script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mclelun.com/lab/jqtwitter/" target="_blank"><img src="http://www.mclelun.com/img/blog/100116_jqtwitter_h.gif" alt="jQuery Twitter Update List" /></a></p>
<p>After my first experiment using jQuery to develop a rotating banner, I noticed that the script I wrote could be use for other similar list items such as a Twitter update list.</p>
<p><span id="more-12"></span></p>
<p>To retrieve recent my tweets, I paste the following JavaScript provided by Twitter into the <code>&lt;body&gt;</code> of my page. </p>
<p><code>&lt;script src="http://twitter.com/javascripts/blogger.js"&gt;&lt;/script&gt;<br />
&lt;script src="http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&amp;count=3"&gt;&lt;/script&gt;</code></p>
<p>Then, I make some simple changes to my jQuery rotating banner script and CSS. Viola! The twitter update list is working as expected. You can view the demo in this <a href="http://www.mclelun.com/lab/jqtwitter/" target="_blank">page</a>.</p>
<h3>Download</h3>
<p>To use this twitter update list, You will need to replace the <code>username</code> with your twitter name. You can also specify how many tweets to retrieve by changing the value of <code>count</code> parameter.</p>
<p><a href="http://www.mclelun.com/lab/jqtwitter/jqtwitter.js">jqtwitter.js</a> 1KB<br />
<a href="http://www.mclelun.com/lab/jqtwitter/jqtwitter.zip">jqbanner.zip</a> 35.5KB</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mclelun.com/blog/2010/01/jquery-twitter-update-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Pong Game</title>
		<link>http://www.mclelun.com/blog/2010/01/javascript-pong-game/</link>
		<comments>http://www.mclelun.com/blog/2010/01/javascript-pong-game/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 18:23:43 +0000</pubDate>
		<dc:creator>mclelun</dc:creator>
				<category><![CDATA[Scripting and Coding]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.mclelun.com/blog/?p=10</guid>
		<description><![CDATA[Back then, most JavaScript usage I saw was just for something simple such as bookmark or pop up window. There weren&#8217;t many fancy examples but this is not true nowadays. Two years had pass since I heard about Ajax from a friend, I finally decide to spend some time on JavaScript. JavaScript and ActionScript Both [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mclelun.com/lab/jspong/" target="_blank"><img src="http://www.mclelun.com/img/blog/100110_jspong_h.gif" alt="JavaScript Pong" /></a></p>
<p>Back then, most JavaScript usage I saw was just for something simple such as bookmark or pop up window. There weren&#8217;t many fancy examples but this is not true nowadays. Two years had pass since I heard about Ajax from a friend, I finally decide to spend some time on JavaScript.</p>
<p><span id="more-10"></span></p>
<h3>JavaScript and ActionScript</h3>
<p>Both JavaScript and ActionScript are based on ECMAScript which means they share identical syntax. So, I don&#8217;t really have a hard time to understand the basic of JavaScript. </p>
<h3>JavaScript Game</h3>
<p>For me, the best way to learn is to get my hands dirty instead of reading tons of text and did nothing. I manage did a simple Pong game even though my knowledge on JavaScript is limited.The game can be view at this <a href="http://www.mclelun.com/lab/jspong/">page</a>.</p>
<blockquote><p>
Pong (marketed as PONG) is one of the earliest arcade video games, and is a tennis sports game featuring simple two-dimensional graphics &#8211; wiki
</p></blockquote>
<p>Flash game is usually loop with an <code>onEnterFrame</code> event. But there aren&#8217;t any &#8220;frames&#8221; in JavaScript, so we will need to construct the game loop by using a <code>setInterval()</code> method. Both JavaScript and ActionScript&#8217;s <code>setInterval</code> is similar, which execute code periodically.</p>
<p>Of course this little game experiment I did doesn&#8217;t really show the power of what JavaScript could do. So, navigate to <a href="http://www.chromeexperiments.com/" target="_blank">Google&#8217;s Chrome Experiments</a> and have a look at some great experiments did by other PROgrammers.</p>
<h3>Download</h3>
<p><a href="http://www.mclelun.com/lab/jspong/">View JavaScript Pong Game</a><br />
<a href="http://www.mclelun.com/lab/jspong/pong.js">pong.js</a> 2.69KB</p>
<h3>JavaScript Framework</h3>
<p>Besides writing your script from scratch, you could also utilize JavaScript framework which will ease your development process. Below are some of the many JavaScript frameworks available.<br />
<a href="http://jquery.com/">JQuery</a><br />
<a href="http://www.mootools.net/">MooTools</a><br />
<a href="http://developer.yahoo.com/yui/">YUI</a><br />
<a href="http://www.prototypejs.org/">Prototype</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mclelun.com/blog/2010/01/javascript-pong-game/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
