<?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>Cthulhu and other crazies &#187; JavaScript</title>
	<atom:link href="http://swizec.com/blog/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://swizec.com/blog</link>
	<description>A blog about life, the universe and everything else</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:44:24 +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>jQuery imageless buttons a la Google get an update</title>
		<link>http://swizec.com/blog/jquery-imageless-buttons-a-la-google-get-an-update/swizec/622</link>
		<comments>http://swizec.com/blog/jquery-imageless-buttons-a-la-google-get-an-update/swizec/622#comments</comments>
		<pubDate>Sun, 12 Jul 2009 12:01:02 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=622</guid>
		<description><![CDATA[That&#8217;s right, after my jQuery plugin for imageless buttons much akin to those Google use in their online apps has been out in the wild for almost six months, an update is now here, making them version &#8230; uhm &#8230; 1.0.3.
During this time jQuery.com claims the code to have been downloaded &#8230; well darn, doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s right, after my <a href="http://swizec.com/code/styledButton/">jQuery plugin for imageless buttons</a> much akin to those <a class="zem_slink" title="Google" rel="wikipedia" href="http://en.wikipedia.org/wiki/Google">Google</a> use in their online apps has been out in the wild for almost six months, an update is now here, making them version &#8230; uhm &#8230; 1.0.3.</p>
<p>During this time <a class="zem_slink" title="JQuery" rel="wikipedia" href="http://en.wikipedia.org/wiki/JQuery">jQuery</a>.com claims the code to have been downloaded &#8230; well darn, doesn&#8217;t say anything since I apparently didn&#8217;t add an actual release. Silly of me. But google analytics claims the page to have been viewed 6222 times, which makes it the single most popular page on this site. Yay.</p>
<p><a href="http://swizec.com/code/styledButton"><img class="alignleft size-full wp-image-623" title="styledButton screenshot" src="http://swizec.com/blog/wp-content/uploads/2009/07/Picture-1.png" alt="styledButton screenshot" width="654" height="142" /></a></p>
<p>Nothing much has actually changed except that I fixed a horrible bug, which prevented you from having tagged captions in buttons with dropdowns &#8211; this surprisingly took all night to fix, since what you&#8217;d normally expect jQuery to do simply melted down and refused to work, yes, even with the latest versions. Aside from that I&#8217;ve also dropped support for <a class="zem_slink" title="Safari (web browser)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Safari_%28web_browser%29">Safari</a> 2 because updating jQuery to 1.3.x killed everything. It was a surprise to me, but the latest jQuery simply refused to load, <em>nothing</em> worked.</p>
<p>However, if you wish to support the old jQuery this imageless buttons plugin should still work as well as ever, except you won&#8217;t be able to use tagged captions for dropdowns.</p>
<p>That makes the list of supported browsers as follows:</p>
<ul>
<li><a class="zem_slink" title="Opera Software" rel="homepage" href="http://www.opera.com">Opera</a> 10 beta</li>
<li>Opera 9.6x</li>
<li><a class="zem_slink" title="Mozilla Firefox" rel="wikipedia" href="http://en.wikipedia.org/wiki/Mozilla_Firefox">Firefox</a> 3</li>
<li>Firefox 2</li>
<li>Safari 4</li>
<li>Safari 3</li>
<li>Internet Explorer 8 beta</li>
<li><a class="zem_slink" title="Internet Explorer 7" rel="wikipedia" href="http://en.wikipedia.org/wiki/Internet_Explorer_7">Internet Explorer 7</a></li>
<li>Internet Explorer 6</li>
<li>Chrome</li>
<li>Adobe <a class="zem_slink" title="Adobe Integrated Runtime" rel="wikipedia" href="http://en.wikipedia.org/wiki/Adobe_Integrated_Runtime">AIR</a> 1.5+</li>
</ul>
<p>Which means it should display pixel perfect and the same in all of those, except of course for any differences in parsing fonts.</p>
<ul></ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/5253e1f6-7bed-401a-894a-32b6f23f2734/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=5253e1f6-7bed-401a-894a-32b6f23f2734" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/jquery-imageless-buttons-a-la-google-get-an-update/swizec/622/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Slovenia php conference day2 (live blogging)</title>
		<link>http://swizec.com/blog/slovenia/swizec/552</link>
		<comments>http://swizec.com/blog/slovenia/swizec/552#comments</comments>
		<pubDate>Sat, 06 Jun 2009 08:18:53 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Dynamic web page]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[phpkonferenca]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=552</guid>
		<description><![CDATA[10:16 Today was horrible walking weather. Groggily stumbling to IJS felt a bit like trying to swim through a sauna. I don&#8217;t even know how late I was getting here, but I somehow managed to snatch the very last energy drink. Yay! Shame I&#8217;m in last row this time &#8230; think we&#8217;re listening to @markostamcar [...]]]></description>
			<content:encoded><![CDATA[<p><strong>10:16</strong> Today was horrible walking weather. Groggily stumbling to IJS felt a bit like trying to swim through a sauna. I don&#8217;t even know how late I was getting here, but I somehow managed to snatch the very last <a class="zem_slink" title="Energy drink" rel="wikipedia" href="http://en.wikipedia.org/wiki/Energy_drink">energy drink</a>. Yay! Shame I&#8217;m in last row this time &#8230; think we&#8217;re listening to @markostamcar talking about &#8230; something. Is this the &#8220;<a class="zem_slink" title="Snippet (programming)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Snippet_%28programming%29">code snippets</a> that saved my life&#8221; talk?</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 310px;">
<dt class="wp-caption-dt"><a href="http://commons.wikipedia.org/wiki/Image:Smoke_sauna.JPG" rel="lightbox[552]"><img title="Smoke sauna in Enonkoski, Finland." src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b8/Smoke_sauna.JPG/300px-Smoke_sauna.JPG" alt="Smoke sauna in Enonkoski, Finland." width="300" height="225" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://commons.wikipedia.org/wiki/Image:Smoke_sauna.JPG" rel="lightbox[552]">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>Oh and before anyone asks again, yes, I&#8217;m the guy in a black bowler and no that card is not an Ace. Never an Ace.</p>
<p><strong>10:29</strong> @markostamcar just admited to being a dirty dirty pirate thief. Wonder if anyone from the MAFIAA is here or we&#8217;re all just a bunch of dirty swashbucklers? Interesting code bit, think it calculates a foreign TV guide into local time for torrent browsing.</p>
<p><strong>10:34</strong> Interesting thing I just noticed. Trying to make fancy &lt;?phpconference in a blog title makes wordpress do funny things like simply cutting everything ahead of &lt;? off. Couldn&#8217;t you please just escape it? It felt lovely having it there and now my url is all funky.</p>
<p><strong>10:51</strong> Miha Hribat made a refreshing <a class="zem_slink" title="Commercial break" rel="wikipedia" href="http://en.wikipedia.org/wiki/Commercial_break">commercial break</a> for <a class="zem_slink" title="Igrajmo.se" rel="homepage" href="http://www.igrajmo.se">igrajmo.se</a>, whatever that is. Looks interesting, but the talk will be about caching dynamic content. Hopefully we&#8217;ll all learn something new even though most of us have probably dealt with this before.</p>
<p><strong>10:58</strong> MogileFS is an opensource filesystem written in perl that runs on the application level and, apparently, uses everything from the DB, disk system and some other funky stuff to keep data safe and bloody quick to access. Sounds very nice. And now the more interesting part about memory caching &#8211; the really important thing when it comes to cache. Oh hey, I just noticed a corporate-approved dry joke. Well done!</p>
<p><strong>11:03</strong> Yes <a class="zem_slink" title="Memcached" rel="homepage" href="http://www.danga.com/memcached/">memcached</a>! The greatest thing since caching was invented and of course, all the big names are using it. Been a while since I played around with this thing, should probably try it again. Miha says the biggest object you can store is 1MB in size and since <a class="zem_slink" title="Twitter" rel="homepage" href="http://twitter.com">Twitter</a> complained about having a problem with one of their important objects exceeding 1MB I&#8217;m concluding twitter uses memcached as well &#8230; oh hey I didn&#8217;t know memcached will only keep things for at most 30 days.</p>
<p><strong>11:35</strong> Anze Znidarsic will be talking about abusing flash+php to make rich internet applications. And he just received a raging applause for giving us a 15 minute break <img src='http://swizec.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Win.</p>
<p><strong>11:54</strong> Anze is talking about Flash on the internets, what we can and what we cannot do. Personally I hope flash dies a quick death and we shouldn&#8217;t be abusing it to do new things like we did with pdf. Sure it&#8217;s difficult to make things work the same in every browser, but we don&#8217;t HAVE TO. What we need to do is teach users that things won&#8217;t look the same everywhere, even native desktop applications don&#8217;t look the same on everyone&#8217;s computer.</p>
<p><strong>12:01 </strong>According to what is being said I&#8217;m really going to need to look into this Flex Builder thing. It&#8217;s quite ama</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 210px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:AsSeenOnTelevision.jpg" rel="lightbox[552]"><img title="As Seen on Television album cover" src="http://upload.wikimedia.org/wikipedia/en/0/05/AsSeenOnTelevision.jpg" alt="As Seen on Television album cover" width="200" height="200" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:AsSeenOnTelevision.jpg" rel="lightbox[552]">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>zing how, apparently, you can just design something in Photoshop, export and then just add some working logic and you&#8217;re done. Looks incredibly simple and like a very fast workflow. Lovely bit is how I can abuse this lecture to pretty much deal away with half the things I could have said on my talk in a few hours. Brilliant! Thanks Anze.</p>
<p><a class="zem_olink" href="http://commons.wikipedia.org/wiki/Image:CeBIT_2006_Philips_3D_Display_42_3D6W01_WOW_Richardson_Electronics_KUKFilm_1298_by_HDTVTotalDOTcom.jpg" rel="lightbox[552]"><strong>12:11</strong></a> That is a wonderfully brilliant sample app. Basically a project managment tool for girls. Stores girl_id and her status that is one of &#8220;Done&#8221;, &#8220;to-do&#8221; or &#8220;in progress&#8221;. Today is definitely much better than yesterday was.</p>
<p><strong>14:06</strong> We&#8217;re back from lunch and Mr. Somebody, didn&#8217;t catch his name, is talking about Comet, which is apparently a method for pushing data from server to client and doing it live. This is something I&#8217;ve always wondered about so I&#8217;m about to have my wet dream answered.</p>
<p><strong>14:12</strong> Comet is interesting. Apparently it&#8217;s some sort of reverse Ajax and once more isn&#8217;t a technology in and of itself (just like Ajax) but an architecture design. HTTP/1.1 allows us to do this crap and even though all of this is starting to make a little sense it&#8217;s quite odd. It&#8217;s polling, but not polling, or is it polling? Damn, can&#8217;t wait for the practical demo. (Oh the guy is Mitja Kramberger, cool guy)</p>
<p><strong>14:20</strong> There almost seems to be more problems with Comet than it provides solutions. Interesting. Since I&#8217;m not actually</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 58px;">
<dt class="wp-caption-dt"><a href="http://twitter.com/robertbasic"><img title="Image of Robert Basic from Twitter" src="http://s3.amazonaws.com/twitter_production/profile_images/184481624/mewhoelse100_normal.jpg" alt="Image of Robert Basic from Twitter" width="48" height="48" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image of <a href="http://twitter.com/robertbasic">Robert Basic</a></dd>
</dl>
</div>
</div>
<p>understanding a whole lot of this (thanks @<a class="zem_slink" title="Robert Basic" rel="blog" href="http://robertbasic.com">robertbasic</a> for giving that wikipedia link) there isn&#8217;t much summation I can do for you blog readers. Sorry. Or maybe I&#8217;m just not paying enough attention since nervousity is building up &#8217;cause I&#8217;m up next. Whose stupid idea was it anyway to get over public talking anxiety by talking publicly a lot? Idiot.</p>
<p><strong>14:31</strong> Comet on the server is where it gets really interesting. Traditional server software is #fail because you need man concurrent connections and they&#8217;re made to quickly close everything and get on with their lives. Someone should implement an event-based IO, but nobody&#8217;s really done anything yet, working on it, just not done. So when somebody DOES make something, will the web be all buzzy and broken and fubar and odd as it was when Ajax first became popular?</p>
<p><strong>14:35</strong> I was wrong. There are many implementations &#8230; makes me wonder why not everyone is doing this just yet like they did with Ajax? Poor gecko browser support? Developer ignorance? What?</p>
<p><strong>16:00</strong> Wow, I&#8217;ve never had so much fun talking in front of a large crowd for 45 minutes before. Not sure what it was, but I simply blabbed my mouth off. There were even questions when I finished! Yay. Anyhow, seems we&#8217;ll be listening to Toma</p>
]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/slovenia/swizec/552/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Adobe AIR&#8217;s javascript no eval or include is moronic</title>
		<link>http://swizec.com/blog/adobe-airs-javascript-no-eval-or-include-is-moronic/swizec/456</link>
		<comments>http://swizec.com/blog/adobe-airs-javascript-no-eval-or-include-is-moronic/swizec/456#comments</comments>
		<pubDate>Wed, 25 Mar 2009 11:18:16 +0000</pubDate>
		<dc:creator>Swizec</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://swizec.com/blog/?p=456</guid>
		<description><![CDATA[



Image via Wikipedia



Some days ago when I was developing a plugin interface for Twitulater I came upon an interesting and seemingly unsolvable problem in the way Adobe AIR brainlessly tries to make everything more secure &#8211; eval function simply doesn&#8217;t work. Even if you use it, nothing happens.
Alright so there is no eval for evaluating [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 212px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Adobe_AIR_icon.png" rel="lightbox[456]"><img title="Adobe AIR" src="http://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Adobe_AIR_icon.png/202px-Adobe_AIR_icon.png" alt="Adobe AIR" width="202" height="202" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Adobe_AIR_icon.png" rel="lightbox[456]">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>Some days ago when I was developing a plugin interface for <a href="http://twitulater.com" target="_blank">Twitulater</a> I came upon an interesting and seemingly unsolvable problem in the way <a class="zem_slink" title="Adobe Integrated Runtime" rel="homepage" href="http://www.adobe.com/products/air/">Adobe AIR</a> brainlessly tries to make everything more secure &#8211; eval function simply doesn&#8217;t work. Even if you use it, nothing happens.</p>
<p>Alright so there is no eval for evaluating dynamically created javascript. No problem, I&#8217;ll just use some sort of include function Adobe has surely implemented since AIR is supposed to be this awesome development platform and we all know the ability to include files is somewhat paramount to serious development.</p>
<p>But what&#8217;s this? Even in AIR 1.5 there STILL isn&#8217;t an include? What the fuck! Ok, sure, I do realise that they provide an include with Flex, but to be honest Flex isn&#8217;t exactly something I want to use because the way variable types are postfixed to the variable name fucks with my brain and makes me feel dyslexic. Seriously Adobe, what WERE you thinking there?</p>
<p>Anyhow, back to lack of eval. Adobe claims that eval is an evil funciton people use to evaluate unverified code from third party API&#8217;s and thus make their applications superbly vulnerable to an injection attack. Naturally this is a very valid reservation, but I think the solution is severely flawed since it introduces more problems than it&#8217;s worth.</p>
<p>Basically everything they&#8217;ve done is force bad developers to use a <a class="zem_slink" title="JSON" rel="wikipedia" href="http://en.wikipedia.org/wiki/JSON">JSON</a> interpreter of some sort for their third-party stuff. Which makes sense, it&#8217;s a little bit slower than eval, but at least no code gets executed since functions and objects produce errors. Great, no executable third-party code. But did this really solve anything? Oh no wait, bad developers will still open their application up to many security flaws and everyone else is more than slightly inconvenienced.</p>
<p>I could understand if Adobe at least put a JSON compiler or some sort of dumbed down eval into their javascript API, but no, they just leave us out to dry. And, surprisingly, none of the <a class="zem_slink" title="JQuery" rel="homepage" href="http://jquery.com/">jQuery</a> include plugins out there actually work, neither does javascript MVC&#8217;s include function. At least I haven&#8217;t been able to make them work.</p>
<p>But there is in fact a way to include all files from a certain dir, it&#8217;s a very fucking ugly hack and using it made my programming heart convulse in pain. See for yourself:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	PluginLoader.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">loadPlugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span> pluginDir <span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#123;</span>
&nbsp;
	        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">shouldLoadPlugin</span><span style="color: #009900;">&#40;</span> pluginDir <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
&nbsp;
	        <span style="color: #009900;">&#123;</span>
&nbsp;
	                <span style="color: #003366; font-weight: bold;">var</span> files <span style="color: #339933;">=</span> pluginDir.<span style="color: #660066;">getDirectoryListing</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	                <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> files <span style="color: #009900;">&#41;</span>
&nbsp;
	                <span style="color: #009900;">&#123;</span>
&nbsp;
	                        <span style="color: #003366; font-weight: bold;">var</span> file <span style="color: #339933;">=</span> files<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	                        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> file.<span style="color: #660066;">extension</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;js&quot;</span> <span style="color: #009900;">&#41;</span>
&nbsp;
	                        <span style="color: #009900;">&#123;</span>
&nbsp;
	                                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">loadFile</span><span style="color: #009900;">&#40;</span> file <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	                        <span style="color: #009900;">&#125;</span>
&nbsp;
	                <span style="color: #009900;">&#125;</span>
&nbsp;
	                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">addLoadedPlugin</span><span style="color: #009900;">&#40;</span> pluginDir.<span style="color: #000066;">name</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	PluginLoader.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">shouldLoadPlugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span> dir <span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#123;</span>
&nbsp;
	        <span style="color: #000066; font-weight: bold;">return</span> dir.<span style="color: #660066;">isDirectory</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> dir.<span style="color: #000066;">name</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'.'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	PluginLoader.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">loadFile</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span> file <span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#123;</span>
&nbsp;
	        <span style="color: #003366; font-weight: bold;">var</span> stream <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> air.<span style="color: #660066;">FileStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        stream.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span> file<span style="color: #339933;">,</span> air.<span style="color: #660066;">FileMode</span>.<span style="color: #660066;">Read</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        <span style="color: #003366; font-weight: bold;">var</span> script <span style="color: #339933;">=</span> stream.<span style="color: #660066;">readUTFBytes</span><span style="color: #009900;">&#40;</span> stream.<span style="color: #660066;">bytesAvailable</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        stream.<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	PluginLoader.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">addLoadedPlugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span> pluginName <span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#123;</span>
&nbsp;
	        document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you can see it relies on injecting HTML javascript inclusion into the head after itself and thus ensuring AIR evaluates it. If you try injecting in any sort of nicer way like with appendChild or whatnot, it doesn&#8217;t work. And the catch is this code has to be run before the document is loaded beyond the head and I think it actually makes AIR spout an error of some sort. But it works.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/e663b415-5f5f-4f6c-ab8f-5d2dbab27a68/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=e663b415-5f5f-4f6c-ab8f-5d2dbab27a68" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://swizec.com/blog/adobe-airs-javascript-no-eval-or-include-is-moronic/swizec/456/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
