<?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>Remus Stratulat - On the Stre@m &#187; JavaScript</title>
	<atom:link href="http://www.stratulat.com/blog/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.stratulat.com/blog</link>
	<description>This is my personal blog</description>
	<lastBuildDate>Sat, 10 Jul 2010 07:07:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Update your JavaScript AIR application with ease.</title>
		<link>http://www.stratulat.com/blog/update-your-javascript-air-application-with-ease</link>
		<comments>http://www.stratulat.com/blog/update-your-javascript-air-application-with-ease#comments</comments>
		<pubDate>Fri, 27 Jun 2008 08:14:59 +0000</pubDate>
		<dc:creator>Remus Stratulat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Update]]></category>

		<guid isPermaLink="false">http://www.stratulat.com/blog/update-your-javascript-air-application-with-ease</guid>
		<description><![CDATA[Web application = instant update One of the most powerful features of a web application is instant update. Your client doesn&#8217;t need to do anything when you fix some bugs in your web application. The next time he accesses the site the user will have the latest version of your application. Update a desktop application [...]]]></description>
			<content:encoded><![CDATA[<h4>Web application = instant update</h4>
<p>One of the most powerful features of a web application is instant update. Your client doesn&#8217;t need to do anything when you fix some bugs in your web application. The next time he accesses the site the user will have the latest version of your application.</p>
<h4>Update a desktop application</h4>
<p>Creating an AIR application means creating a desktop one. It comes with all the benefits of this type of application but also with some of the drawbacks. And one of them is the challenge of updating the application to the most recent version. </p>
<p>Of course this is not a new subject and a lot of applications have their own method of doing updates and upgrades. Adobe AIR has now the <a href="http://labs.adobe.com/wiki/index.php/Adobe_AIR_Update_Framework">Update Framework</a>, a Flex library that helps you update any AIR application non intrusively, similar to any web application.</p>
<h4>Adobe AIR Update Framework</h4>
<p>Now, I talked at the beginning about updating a JavaScript AIR application and just above I mentioned that the update framework is a Flex component. That is true and it is very easy to use this component even without any Flex knowledge. To demonstrate this technology I will use the microlink application that I wrote recently.</p>
<p>First, copy the <strong><em>applicationupdater_ui.swf</em></strong> found in the update framework into your project. (You can download the update framework from <a href="http://labs.adobe.com/wiki/index.php/Adobe_AIR_Update_Framework">here</a>). Because I am using Flex Builder 3 to develop this application the updater component will be placed under the <strong><em>src</em></strong> folder inside my project. </p>
<p>&#160; <img border="0" alt="update_swf" src="http://www.stratulat.com/blog/wp-content/update-swf.gif" width="259" height="359" /> </p>
<p>Next, create the update descriptor file. This is a small XML file that contains all the information needed by the updater. This includes the version number, the application location on your server and a description where details about the improvements in the new version can be written.</p>
<pre class="csharpcode"><span class="kwrd">&lt;?</span><span class="html">xml</span> <span class="attr">version</span>=&#8220;<span class="attr">1</span>.<span class="attr">0</span>&#8243; <span class="attr">encoding</span>=&#8220;<span class="attr">utf-8</span>&#8243;?<span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">update</span> <span class="attr">xmlns</span>=&#8220;<span class="attr">http:</span>//<span class="attr">ns</span>.<span class="attr">adobe</span>.<span class="attr">com</span>/<span class="attr">air</span>/<span class="attr">framework</span>/<span class="attr">update</span>/<span class="attr">description</span>/<span class="attr">1</span>.<span class="attr">0</span>&#8243;<span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">version</span><span class="kwrd">&gt;</span>0.3<span class="kwrd">&lt;/</span><span class="html">version</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">url</span><span class="kwrd">&gt;</span>http://localhost:8080/releases/MyAirApp.air<span class="kwrd">&lt;/</span><span class="html">url</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">description</span><span class="kwrd">&gt;&lt;!</span>[CDATA[
Version 0.3 of this application includes the updateing framework.
  ]]<span class="kwrd">&gt;&lt;/</span><span class="html">description</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">update</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>I will name this file <em><strong>update.xml</strong></em> and this will go on the web server. I placed it in the same location as my AIR application so it is reachable from <a href="http://localhost:8080/releases/update.xml">http://localhost:8080/releases/update.xml</a>.</p>
<p>We will want to check for updates each time the application is started. Of course we can also choose to create a menu item or a button to let the user explicitly request a check for updates. In either case, we have to write some JavaScript code to wire things together. JavaScript code in AIR applications can use classes defined in SWF files.</p>
<p>In the HTML file that will use the update framework (in our case index.html) we have to include a script tag that loads the framework. </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">src</span><span class="kwrd">=&quot;ApplicationUpdater_UI.swf&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;application/x-shockwave-flash&quot;</span><span class="kwrd">/&gt;</span></pre>
<p>After we include the update framework in our application we have to use it. The instantiation and configuration of this is described inside the comments in the next piece of code, from index.html</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 251px; background-color: #f4f4f4; max-height: 200px">
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">meta</span> <span class="attr">http-equiv</span><span class="kwrd">=&quot;Content-Type&quot;</span> <span class="attr">content</span><span class="kwrd">=&quot;text/html; charset=UTF-8&quot;</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>My first AIR application<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;microlink.css&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">type</span><span class="kwrd">=&quot;text/javascript&quot;</span> <span class="attr">src</span><span class="kwrd">=&quot;lib/AIRIntrospector.js&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
        &lt;script src=<span class="str">&quot;applicationupdater_UI.swf&quot;</span> type=<span class="str">&quot;application/x-shockwave-flash&quot;</span>/&gt;

        &lt;script src=<span class="str">&quot;lib/jquery-1.2.6.js&quot;</span>&gt;&lt;/script&gt;
        &lt;script src=<span class="str">&quot;microlink.js&quot;</span>&gt;&lt;/script&gt;
        &lt;script&gt;
        <span class="rem">// instantiate an updater object</span>
           <span class="kwrd">var</span> appUpdater = <span class="kwrd">new</span> runtime.air.update.ApplicationUpdaterUI();

        <span class="kwrd">function</span> load() {
            <span class="rem">// ApplicationUpdaterUI can be configured via a configuration file </span>
            <span class="rem">// delivered with the application or via JavaScript in the application.</span>
            appUpdater.configurationFile =
                <span class="kwrd">new</span> runtime.flash.filesystem.File(<span class="str">&quot;app:/config/updateConfig.xml&quot;</span>);

            <span class="rem">// setting the event handler for INITIALIZED</span>
            appUpdater.addEventListener(runtime.air.update.events.UpdateEvent.INITIALIZED,
                onUpdate);

            <span class="rem">// It initializes the update framework, silently installing synchronously </span>
            <span class="rem">// any pending updates. It is required to call this method during application</span>
            <span class="rem">// startup because it may restart the application when it is called.</span>
            appUpdater.initialize();
        }

        <span class="kwrd">function</span> onUpdate(<span class="kwrd">event</span>) {
            <span class="rem">//starts the update process</span>
            appUpdater.checkNow();
        }

        <span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>

    <span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">body</span> <span class="attr">onload</span><span class="kwrd">=&quot;load()&quot;</span><span class="kwrd">&gt;</span>

    <span class="kwrd">&lt;</span><span class="html">h1</span><span class="kwrd">&gt;</span>this is my first AIR app.<span class="kwrd">&lt;/</span><span class="html">h1</span><span class="kwrd">&gt;</span>

    <span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">id</span><span class="kwrd">=&quot;microlink_a&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;http://www.stratulat.com/blog/feed&quot;</span> <span class="attr">class</span><span class="kwrd">=&quot;button&quot;</span>
        <span class="attr">onClick</span><span class="kwrd">=&quot;onClickMicroLink(this); return false;&quot;</span><span class="kwrd">&gt;</span>the microlink<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span>

    <span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
</div>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The <strong><em>updateConfig.xml</em></strong> file can set up a lot of parameters for the application updater, most of them related to the behavior of the UI. Only one, however required for the updater to perform well and that is the URL to the update.xml on the server.</p>
<p>I configured updateConfig.xml so that at startup the application first asks if the user wants to check for updates.  If so, because I have set up my application version as being 0.2 and inside the update.xml as 0.3, the application displays the update available UI, which shows all the information I’ve set up in the update.xml file on the server.</p>
<p><a href="http://www.stratulat.com/blog/wp-content/update-ui1.gif"><img border="0" alt="update_ui1" src="http://www.stratulat.com/blog/wp-content/update-ui1-thumb.gif" width="260" height="115" /></a> <a href="http://www.stratulat.com/blog/wp-content/update-ui2.gif"><img border="0" alt="update_ui2" src="http://www.stratulat.com/blog/wp-content/update-ui2-thumb.gif" width="260" height="189" /></a> </p>
<p>In this short demo on how to use the Update Framework I showed all the required steps in order to use it. There is one thing however that was not covered and that is error handling. </p>
<p>I have exported my project from Flex Builder 3 and you can download it from here: <a href="http://www.stratulat.com/blog/wp-content/MyAirApp.zip">MyAirApp.zip</a>.</p>
<h4>Adobe AIR Update Framework &#8211; Flex</h4>
<p>I was inspired in this article by the one written by Mihai Corlan on his blog: <a href="http://corlan.org/2008/06/19/how-to-easily-and-seamlessly-update-an-air-application/">How to easily and seamlessly update an AIR application</a>. The article discusses exactly the same topic but from the Flex perspective. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stratulat.com/blog/update-your-javascript-air-application-with-ease/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>JavaScript AIR application &#8211; microlink</title>
		<link>http://www.stratulat.com/blog/javascript-air-application-microlink</link>
		<comments>http://www.stratulat.com/blog/javascript-air-application-microlink#comments</comments>
		<pubDate>Tue, 24 Jun 2008 12:19:55 +0000</pubDate>
		<dc:creator>Remus Stratulat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.stratulat.com/blog/javascript-air-application-microlink</guid>
		<description><![CDATA[I wrote about how Flex Builder 3 can be used to create a JavaScript AIR application, how to set up the environment and how to debug a JavaScript AIR application. It is now time to actually create one that does something more than just displaying &#34;Hello world&#34;. For that, I returned to an article written [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote about how Flex Builder 3 can be used to create a JavaScript AIR application, how to set up the environment and how to debug a JavaScript AIR application. It is now time to actually create one that does something more than just displaying &quot;Hello world&quot;. For that, I returned to an article written by me a about an <a href="http://www.stratulat.com/technical/ajax/a1/?article=AJAX%20-%20microlink%20pattern">Ajax pattern called microlink</a>.</p>
<p>A microlink is a link that opens up content below it. It is a way to improve the ordinary link using Ajax.</p>
<p>In the original article I have used prototype.js and scriptaculous to implement this. Now I am using <a href="http://jquery.com/">jquery </a>because it is AIR-ready. That means it works off the shelf in AIR.</p>
<p><img alt="" src="http://www.stratulat.com/blog/wp-content/microlink_nav.gif" /></p>
<p>If we look into the Flex Navigator view we can see some new resources that are used in order to make the application. Let&#8217;s explain each of them one by one.</p>
<p><i><b>microlink.css</b></i> is the stylesheet and is actually optional so I will not talk about this too much. I have used it in order to make the link more visible.</p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span>.button {</pre>
<pre><span class="lnum">   2:  </span>   color: <span class="rem">#003399;</span></pre>
<pre class="alt"><span class="lnum">   3:  </span> }</pre>
<pre><span class="lnum">   4:  </span>&#160;</pre>
<pre class="alt"><span class="lnum">   5:  </span>.button:hover {</pre>
<pre><span class="lnum">   6:  </span>   text-decoration: none;</pre>
<pre class="alt"><span class="lnum">   7:  </span>     color: <span class="rem">#66ffcc;</span></pre>
<pre><span class="lnum">   8:  </span>     background-color: <span class="rem">#003399;</span></pre>
<pre class="alt"><span class="lnum">   9:  </span> }</pre>
<pre><span class="lnum">  10:  </span>&#160;</pre>
<pre class="alt"><span class="lnum">  11:  </span>.button:active {</pre>
<pre><span class="lnum">  12:  </span>   color: <span class="rem">#ffffff;</span></pre>
<pre class="alt"><span class="lnum">  13:  </span>   background-color: <span class="rem">#0099cc;</span></pre>
<pre><span class="lnum">  14:  </span> }</pre>
<pre class="alt"><span class="lnum">  15:  </span>&#160;</pre>
<pre><span class="lnum">  16:  </span>.microdiv {</pre>
<pre class="alt"><span class="lnum">  17:  </span>    background-color: <span class="rem">#ccccff;</span></pre>
<pre><span class="lnum">  18:  </span>    border: 1px solid <span class="rem">#9999cc;</span></pre>
<pre class="alt"><span class="lnum">  19:  </span>}</pre>
</div>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; background-color: #ffffff; color: #000000;}
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p><i><b>microlink.js</b></i> is the actual JavaScript piece of code that makes a regular link into a microlink. It contains just one function to handle the click event.</p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="rem">/**</span></pre>
<pre><span class="lnum">   2:  </span><span class="rem"> * Function called when the microlink is called to update </span></pre>
<pre class="alt"><span class="lnum">   3:  </span><span class="rem"> * the div with remote content.</span></pre>
<pre><span class="lnum">   4:  </span><span class="rem"> * </span></pre>
<pre class="alt"><span class="lnum">   5:  </span><span class="rem"> * @param {element} e the element that fired the event.</span></pre>
<pre><span class="lnum">   6:  </span><span class="rem"> */</span></pre>
<pre class="alt"><span class="lnum">   7:  </span><span class="kwrd">function</span> onClickMicroLink(e)  {</pre>
<pre><span class="lnum">   8:  </span>    <span class="kwrd">var</span> elID = e.id;</pre>
<pre class="alt"><span class="lnum">   9:  </span>    <span class="kwrd">var</span> divID = elID.substr(0, elID.length-2); <span class="rem">// remove trailing '_a'</span></pre>
<pre><span class="lnum">  10:  </span>    </pre>
<pre class="alt"><span class="lnum">  11:  </span>    $(<span class="str">'#'</span>+elID).after(<span class="str">' &lt;div id=&quot;'</span>+ divID +<span class="str">'&quot; class=&quot;microdiv&quot; '</span> +</pre>
<pre><span class="lnum">  12:  </span>            <span class="str">'style=&quot;display:none&quot;&gt;&lt;/div&gt;'</span>);</pre>
<pre class="alt"><span class="lnum">  13:  </span>            </pre>
<pre><span class="lnum">  14:  </span>    <span class="rem">// Performs an AJAX request and updates a container's contents </span></pre>
<pre class="alt"><span class="lnum">  15:  </span>    <span class="rem">// based on the response text.</span></pre>
<pre><span class="lnum">  16:  </span>    <span class="rem">// @see http://docs.jquery.com/Ajax</span></pre>
<pre class="alt"><span class="lnum">  17:  </span>    $.ajax({</pre>
<pre><span class="lnum">  18:  </span>        url: e.href,</pre>
<pre class="alt"><span class="lnum">  19:  </span>        dataType: <span class="str">'text'</span>,</pre>
<pre><span class="lnum">  20:  </span>        cache: <span class="kwrd">false</span>,</pre>
<pre class="alt"><span class="lnum">  21:  </span>        success: <span class="kwrd">function</span>(text){</pre>
<pre><span class="lnum">  22:  </span>            $(<span class="str">'#'</span>+divID).append(text);</pre>
<pre class="alt"><span class="lnum">  23:  </span>            $(<span class="str">'#'</span>+divID).fadeIn(<span class="str">&quot;slow&quot;</span>);</pre>
<pre><span class="lnum">  24:  </span>        }</pre>
<pre class="alt"><span class="lnum">  25:  </span>    });</pre>
<pre><span class="lnum">  26:  </span>} </pre>
</div>
<p>Inside the index.html I have added just one more line (aside from including the jquery library):</p>
<div class="csharpcode">
<pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">id</span><span class="kwrd">=&quot;microlink_a&quot;</span> </pre>
<pre><span class="lnum">   2:  </span>     <span class="attr">href</span><span class="kwrd">=&quot;http://www.stratulat.com/blog/feed&quot;</span> </pre>
<pre class="alt"><span class="lnum">   3:  </span>     <span class="attr">class</span><span class="kwrd">=&quot;button&quot;</span> </pre>
<pre><span class="lnum">   4:  </span>     <span class="attr">onClick</span><span class="kwrd">=&quot;onClickMicroLink(this); return false;&quot;</span><span class="kwrd">&gt;</span>the microlink<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span></pre>
</div>
<p>Now running the application will show a link. When you click this link an Ajax call will be made to the feeds page of this site. The response is treated as text and it will be injected as the contend of the div created on line 11. Of course, the real use of this is to replace the href of this link with something that is indeed valuable for your application. </p>
<p>This small example covers more than just creating a microlink. It also shows how to make an Ajax call from an AIR application and how to use the response which is done in just the same way as in a browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stratulat.com/blog/javascript-air-application-microlink/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Flex Builder 3 to create a JavaScript AIR application &#8211; debugging.</title>
		<link>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application-debugging</link>
		<comments>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application-debugging#comments</comments>
		<pubDate>Thu, 12 Jun 2008 13:40:42 +0000</pubDate>
		<dc:creator>Remus Stratulat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.stratulat.com/blog/?p=123</guid>
		<description><![CDATA[In the first part of this article I wrote about how Flex Builder 3 can be used to create a JavaScript AIR application and how to set up the environment. Going forward, one big part of developing an application is debugging it. The instrospector tool I am talking about does not help to debug an [...]]]></description>
			<content:encoded><![CDATA[<p>In the first part of this article I wrote about how Flex Builder 3 can be used to create a JavaScript AIR application and how to set up the environment.</p>
<p>Going forward, one big part of developing an application is debugging it. The instrospector tool I am talking about does not help to debug an application in the same way the JDT debugger helps debug Java applications. Actually it works more like Firebug.</p>
<p>First you need to copy one file into the source folder of your project:</p>
<p><em>&#8220;c:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\air\AIRIntrospector.js&#8221;</em></p>
<p><img class="alignnone size-full wp-image-124" title="include_myairapp" src="http://www.stratulat.com/blog/wp-content/include_myairapp.jpg" alt="copy AIRIntrospector.js into your project" /></p>
<p>The second step is to include it into your application:</p>
<p><img class="alignnone size-full wp-image-125" title="script_myairapp" src="http://www.stratulat.com/blog/wp-content/script_myairapp.jpg" alt="import AIRIntrospector into your project" /></p>
<p>If you run the application right now, nothing will happen. The introspector is not started unless it is used. So let&#8217;s use it to see how it works. For that I will add the following piece of code just above the <em>&lt;body&gt;</em> tag.</p>
<blockquote><p>&lt;script&gt;<br />
air.Introspector.Console.log(window);<br />
&lt;/script&gt;</p></blockquote>
<p>I made it a little bit interesting by logging the <em>window </em>object to see the power of this introspector.</p>
<p><img class="alignnone size-full wp-image-126" title="console_myairapp" src="http://www.stratulat.com/blog/wp-content/console_myairapp.jpg" alt="Adobe AIR Introspector" /></p>
<p>You are now able to explore the entire structure of the <em>window </em>object to see exactly the value for each member. This console is a very powerful tool. As you can see there are more features there and we will explore those later. More about Adobe AIR Introspector can be found on the Adobe help resource center <a title="Debugging with the AIR HTML Introspector " href="http://livedocs.adobe.com/air/1/devappshtml/help.html?content=dg_part_3_1.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application-debugging/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Flex Builder 3 to create a JavaScript AIR application.</title>
		<link>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application</link>
		<comments>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application#comments</comments>
		<pubDate>Wed, 04 Jun 2008 20:38:15 +0000</pubDate>
		<dc:creator>Remus Stratulat</dc:creator>
				<category><![CDATA[JSEclipse]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.stratulat.com/blog/?p=108</guid>
		<description><![CDATA[I have tried today to create an AIR application. My tool of choice was Flex Builder 3 as I knew you can create AIR applications using it. So let&#8217;s see what I have done. Of course, first I have created the AIR project: From the beginning I have spotted a problem in this picture: there [...]]]></description>
			<content:encoded><![CDATA[<p>I have tried today to create an AIR application. My tool of choice was Flex Builder 3 as I knew you can create AIR applications using it.</p>
<p>So let&#8217;s see what I have done.</p>
<p>Of course, first I have created the AIR project:</p>
<p><img class="alignnone size-medium wp-image-109" title="nfp_myairapp" src="http://www.stratulat.com/blog/wp-content/nfp_myairapp.jpg" alt="New Flex Project - MyAirApp" /></p>
<p>From the beginning I have spotted a problem in this picture: there was no mention to HTML or JavaScript or anything. Adobe AIR has the capabilities to render HTML and one of the strongest points of this framework is that a web developer can basicaly hit the ground running and just program his way into the desktop world using HTML and JavaScript.</p>
<p>Going forward, I have search resources to see what is the tooling support for this and I found in Adobe&#8217;s documentation an entry about this: <a title="AIR development tools" href="http://livedocs.adobe.com/air/1/devappshtml/">AIR development tools</a>. Obviously, even if is not mentioned in that chapter of documentation, Flex Builder 3 has suppor for creating AIR applications so let&#8217;s persue this further and set up the environment.</p>
<p>If we run the application right now, MyAirApp window shows up as a Flex AIR application. We need to change that so MyAirApp to render html.</p>
<p>First let&#8217;s create <em>index.html</em> and set it up to be used by the AIR application. To do that the <em>bin-degug/MyAirApp-app.xml</em> file should be edited and change two tags: <strong>content </strong>and <strong>visible</strong>. Yes I now, is not a very elegant thing to do. Is just the first thing that helped me. I&#8217;ll try to find a less hackish way to this. If you already know one please share it with us.</p>
<p><img class="alignnone size-full wp-image-112" title="set_myairapp1" src="http://www.stratulat.com/blog/wp-content/set_myairapp1.jpg" alt="" /></p>
<p>Running now the application will render:</p>
<p><img class="alignnone size-full wp-image-110" title="html_myairapp" src="http://www.stratulat.com/blog/wp-content/html_myairapp.jpg" alt="" width="313" height="206" /></p>
<p>So here is my first HTML AIR application. OK, I said JavaScript AIR application into the title. This is only the first step to get there. More will come soon.</p>
<p>Have fun coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stratulat.com/blog/use-flex-builder-3-to-create-a-javascript-air-application/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Adobe AIR for JavaScript Developers Pocket Guide</title>
		<link>http://www.stratulat.com/blog/adobe-air-for-javascript-developers-pocket-guide</link>
		<comments>http://www.stratulat.com/blog/adobe-air-for-javascript-developers-pocket-guide#comments</comments>
		<pubDate>Wed, 07 May 2008 09:08:03 +0000</pubDate>
		<dc:creator>Remus Stratulat</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.stratulat.com/blog/?p=104</guid>
		<description><![CDATA[The official guide to Adobe AIR, written by members of the AIR team, is out. One of the authors, Dragos Georgita is my colleague. He is the engineering manager for the Adobe AIR team here in Romania. He and his team are doing a lot of great things, especially related to AIR and JavaScript. We [...]]]></description>
			<content:encoded><![CDATA[<p>The official guide to Adobe AIR, written by members of the AIR team, is out. One of the authors, Dragos Georgita is my colleague. He is the engineering manager for the Adobe AIR team here in Romania. He and his team are doing a lot of great things, especially related to AIR and JavaScript.</p>
<p>We are all here at the office very proud of him and we wish him many books to come. (I am still waiting for my signed copy <img src='http://www.stratulat.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>You can buy the book from amazon: <a title="Adobe AIR for JavaScript Developers Pocket Guide" href="http://www.amazon.com/Adobe-JavaScript-Developers-Pocket-Guides/dp/0596518374/ref=pd_bbs_sr_12?ie=UTF8&amp;s=books&amp;qid=1210143902&amp;sr=8-12">Adobe AIR for JavaScript Developers Pocket Guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stratulat.com/blog/adobe-air-for-javascript-developers-pocket-guide/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
