<?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>ZBlog &#187; as2</title>
	<atom:link href="http://blog.zarate.tv/category/as2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zarate.tv</link>
	<description>Using the law to keep justice away</description>
	<lastBuildDate>Tue, 24 Aug 2010 11:50:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Counting your lines of ActionScript</title>
		<link>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/</link>
		<comments>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 16:38:00 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1394</guid>
		<description><![CDATA[Have you ever been curious about how many lines of AS a project had? To be honest, I couldn&#8217;t care less but hey, there&#8217;re clients out there with pretty good reasons for it.
So, Google a little bit, first result takes me to CLOC.
In theory you should be able to restrict CLOC to a language only [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been curious about how many lines of AS a project had? To be honest, I couldn&#8217;t care less but hey, there&#8217;re clients out there with pretty good reasons for it.</p>
<p>So, <a href="http://www.google.co.uk/search?sourceid=chrome&#038;ie=UTF-8&#038;q=count+lines+of+code">Google</a> a little bit, first result takes me to <a href="http://cloc.sourceforge.net/">CLOC</a>.</p>
<p>In theory you should be able to restrict CLOC to a language only but most likely due to my incompetence with regular expressions I couldn&#8217;t get it to work the way I liked it. So doing a little bit of command line trickery, I had to create a text file containing the path of the AS files I wanted to parse and then feed that to CLOC. This is how it looks:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">find</span> <span class="kw2">dir</span> <span class="re5">-type</span> f <span class="re5">-iname</span> <span class="sy0">*</span>.as <span class="sy0">&gt;</span> asfiles.txt</div>
</li>
</ol>
</div>
</div>
<p>Then send that to CLOC:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">perl</span> cloc <span class="re5">&#8211;list-file</span>=asfiles.txt <span class="re5">&#8211;quiet</span> <span class="re5">&#8211;report</span>=module_report.txt <span class="re5">&#8211;no3</span> <span class="re5">&#8211;strip-comments</span>=nc <span class="re5">&#8211;original-dir</span></div>
</li>
</ol>
</div>
</div>
<p>That would be the simpler option. But because my project is made of modules (it&#8217;s a multicore <a href="http://puremvc.org/">PureMVC</a> app) and the client wanted <em>both</em> stats per-module <em>and</em> global, I had to push it a little bit further. Basically create a stats file per module and then merge them together. Piece of cake:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">perl</span> cloc <span class="re5">&#8211;no3</span> <span class="re5">&#8211;sum-reports</span> &#8211;report_file=overall moduleReport1 moduleReport2 moduleReportN</div>
</li>
</ol>
</div>
</div>
<p>Where &#8220;overall&#8221; is the name of the final output file (actually, 2 files are created, one per file, other per language) and &#8220;moduleReportX&#8221; files are the partial report created before for each module.</p>
<p>Another good thing about CLOC is that it runs in both OSX and Ubuntu at least pretty much out of the box because both come with Perl installed. However, had a little problem in Ubuntu but contacted Al Danial (the author) and he fixed it right away. If you are running Perl 5.10, go to the line 1038 of CLOC and replace &#8220;%&#8221; by &#8220;@&#8221;.</p>
<p>Good to go!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2009/12/12/counting-your-lines-of-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KuneriLite ActionScript API</title>
		<link>http://blog.zarate.tv/2009/07/11/kunerilite-actionscript-api/</link>
		<comments>http://blog.zarate.tv/2009/07/11/kunerilite-actionscript-api/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 18:58:29 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[as2]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=1149</guid>
		<description><![CDATA[I&#8217;m building a little app for Nokia S60s that has to talk to the GPS, and we decided to use KuneriLite, the Flash-on-steroids wrapper for mobile devices that cool kids in town use these days. Because of HippoHX now every time I see/use a Flash wrapper can&#8217;t help to compare with it, but I&#8217;ll leave [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m building a little app for Nokia S60s that has to talk to the GPS, and <a href="http://ustwo.co.uk/">we</a> decided to use <a href="http://www.kunerilite.net/">KuneriLite</a>, the Flash-on-steroids wrapper for mobile devices that cool kids in town use these days. Because of <a href="http://hippohx.com/">HippoHX</a> now every time I see/use a Flash wrapper can&#8217;t help to compare with it, but I&#8217;ll leave that for the end of the post.</p>
<p>Setting up Kuneri is a little bit messy. There&#8217;s a nice list of very specific requirements, so my advice if you want to give it a go is:</p>
<p>1) Get Kuneri, install and open the requirements wizard.<br />
2) Install the requirements the wizard tells you about in the same order and the same versions, <strong>use the links they provide</strong>. I specially got problems with S60 SDK because I got a wrong version. With Java I saw the <a href="http://www.dandolachapa.com/2008/05/12/flex-3-sdk-msvcr71dll-not-found/">missing DLL error</a>. </p>
<p>[BTW, to download the S60 SDK you have to register with Nokia, what a nice way to annoy your developers. I'd like to know the % of real data they get. So well done Adobe for not requiring this annoying step to get Flex SDK]</p>
<p>3) Until you can&#8217;t compile the test application, you will not be good to go.</p>
<p>Once you are all set up, you can start using Kuneri. Create a new project, add the plugins you want to use, compile, install and live happy ever after.</p>
<p><strong><em>Where&#8217;s my API dude?</em></strong></p>
<p>It turns out Kuneri is a tiny webserver on the phone, thus you communicate doing http requests and parsing the results you get. Somehow weird, but whatever, I&#8217;ll play along. What I was <strong>really</strong> surprised about is that there&#8217;s no official higher ActionScript API. I mean, if you want to talk to the GPS, the <a href="http://wiki.kunerilite.net/index.php?title=GPS_plugin">documentation</a> tells you to do something like this:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">loadVariables</span><span class="br0">&#40;</span><span class="st0">&quot;http://127.0.0.1:1001/Basic/GPS?klCommand=read&quot;</span>,<span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
<p>loadVariables? Sorry, <em>are you from the past?</em> Apparently they are not, they recommend loadVariables to be compatible with FlashLite 1.1. But because of that you also have to use a MovieClip and an interval to receive the answer from the server. A graphical element to receive the answer from a network call, that&#8217;s good ol&#8217;Flash in all its glory!</p>
<p>The point is KuneriLite doesn&#8217;t provide at the moment a clean ActionScript API to use their plugins, they only document how you should make the requests and what you should expect as their response. No way in hell I&#8217;m going through that so I&#8217;m presenting (drum roll, please):</p>
<p><a href="http://code.google.com/p/kuneri-api/">Kuneri ActionScript API</a></p>
<p>Check it out:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> gps : GPS = <span class="kw2">new</span> GPS<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">gps.<span class="me1">read</span><span class="br0">&#40;</span>Delegate.<span class="me1">create</span><span class="br0">&#40;</span><span class="kw3">this</span>, handler<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> handler<span class="br0">&#40;</span>response : GPSResponse<span class="br0">&#41;</span> : <span class="kw3">Void</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span>response.<span class="me1">latitude</span> + <span class="st0">&quot;, &quot;</span> + response.<span class="me1">longitude</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p>That&#8217;s much better. Not only you hide all the crap of calling the server, you also get a strictly typed response. Sweet. ATM I&#8217;ve only created the API for the GPS because that&#8217;s what I need now, and also the Camera for the sake of it, really. I&#8217;m not sure if I&#8217;m going complete it and I&#8217;m almost sure I&#8217;m not going to keep up in sync with Kuneri development, so if anyone is interested, please contact me, I&#8217;ll gladly handover the project.</p>
<p>Special thanks to mr <a href="http://www.elecash.org/blog/">Elecash</a> for explaining to me the <em>why-the-hell-they-use-loadVariables</em> mystery and for pointing out <a href="http://forum.kuneri.net/index.php/topic,184.0.html">this nice bug</a> that, thanks to him, nobody else has to suffer. Plus, he&#8217;s always available on IM for my silly FlashLite doubts. Yo! Thanks mate :)</p>
<p><strong><em>Extra ball: KuneriLite vs HippoHX</em></strong></p>
<p>As I said at the beginning, can&#8217;t help but compare Kuneri with HippoHX. Here we go:</p>
<p>- Both are based on somebody else&#8217;s codebase (SWHX and S60 SDK), but because SWHX is Open Source I can redistribute it myself saving the hassle to my final user, something that Kuneri can&#8217;t with Nokia&#8217;s SDK. Another nice side effect is that if a new version of SWHX breaks HippoHX for some reason, I can hold the HippoHX release till I fix the problem.</p>
<p>- HippoHX GUI is only that, a GUI to the CLI packager, so you can integrate it with your compilation scripts. I have the feeling that Kuneri GUI is the same, but haven&#8217;t seen the documentation.</p>
<p>- HippoHX GUI doesn&#8217;t use the installation folder to store its data, it uses user&#8217;s space for that. See <a href="http://stackoverflow.com/questions/57019/where-should-cross-platform-apps-keep-their-data">Where should cross-platform apps keep their data?</a> to know why.</p>
<p>- SWHX and HippoHX are for Win and Mac and Kuneri is Windows only. Might be because of the dependencies, but I&#8217;m not sure.</p>
<p>- I can&#8217;t find a download for the documentation, it seems to be on-line only.</p>
<p>Some of these are bigger deals than others, and I&#8217;m sure the Kuneri team will fix them in the future, but being a commercial app, I feel most of them could/should have been fixed already.</p>
<p>Anyway, will add a link to the OVI store (Nokia&#8217;s copycat of the Apple store) once the app is finished and ready to download. It&#8217;s a little silly app, but, hey, I coded it!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2009/07/11/kunerilite-actionscript-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The AS3 to AS2 painful comeback</title>
		<link>http://blog.zarate.tv/2009/04/20/the-as3-to-as2-painful-comeback/</link>
		<comments>http://blog.zarate.tv/2009/04/20/the-as3-to-as2-painful-comeback/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 15:52:03 +0000</pubDate>
		<dc:creator>Zarate</dc:creator>
				<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>

		<guid isPermaLink="false">http://blog.zarate.tv/?p=895</guid>
		<description><![CDATA[Just hit last Friday the first deadline of an AS2 project I&#8217;ve been working on with the guys at UsTwo. Can&#8217;t say much about the project (hasn&#8217;t been released + NDAs) but I can say it was AS2. And it was AS2 because it&#8217;s FlashLite for a &#8220;mobile device&#8221; that wasn&#8217;t a phone.
Having moved to [...]]]></description>
			<content:encoded><![CDATA[<p>Just hit last Friday the first deadline of an AS2 project I&#8217;ve been working on with the guys at <a href="http://ustwo.co.uk/">UsTwo</a>. Can&#8217;t say much about the project (hasn&#8217;t been released + NDAs) but I can say it was AS2. And it was AS2 because it&#8217;s FlashLite for a &#8220;mobile device&#8221; that wasn&#8217;t a phone.</p>
<p>Having moved to AS3, the comeback is painful. Even though I was using FDT (still not liking it), even though we were using PureMVC, even though we were using MTASC + SWFMill, even though we were using Ant, even though I&#8217;ve been working with really talented people, the comeback to AS2 is still painful. <em>createEmptyMovieClip</em>, <em>attachMovie</em>, no built-in EventDispatcher, no complains at runtime if you pass the wrong parameters to a function&#8230; But the one mistake I&#8217;ve made the most is delegates. You remember them? If you don&#8217;t, I&#8217;m sure you aren&#8217;t doing AS2 any more.</p>
<p>This is what I did at least 3 times in 7 weeks:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">myButton.<span class="kw3">onPress</span> = myFunction;</div>
</li>
</ol>
</div>
</div>
<p>But what I really <em>wanted</em> to do was:</p>
<div class="codesnip-container" >
<div class="actionscript codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1">myButton.<span class="kw3">onPress</span> = Delegate.<span class="me1">create</span><span class="br0">&#40;</span><span class="kw3">this</span>,myFunction<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</div>
<p>Problem is you don&#8217;t get an error at compile time (or at runtime for that matter), you just lose the scope and get weird results. Depending on how awake you are at that time of the day it might take you a little longer to realize, swear, fix your bug and move on.</p>
<p>I&#8217;ve heard a lot of developers saying that they wouldn&#8217;t come back to AS2 for all the money in the world, and I understand that feeling. But there&#8217;re a TON of opportunities in FlashLite projects already, let alone when <a href="http://slashdot.org/article.pl?sid=09/04/20/1221251">the Open Screen Project starts to pay off</a>. And because I don&#8217;t see Adobe releasing an AS3 FlashLite player any time soon, we need to suck it up and do AS2.</p>
<p>At least this one was for a good project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zarate.tv/2009/04/20/the-as3-to-as2-painful-comeback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
