<?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>neatFilm.com &#187; ActionScript 3</title>
	<atom:link href="http://www.neatfilm.com/category/actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neatfilm.com</link>
	<description></description>
	<lastBuildDate>Sat, 26 Jun 2010 17:03:05 +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>Flex Interface Design with Scale9Grid Bitmap Class, another approach</title>
		<link>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/</link>
		<comments>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 07:07:43 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=381</guid>
		<description><![CDATA[Recently I changed my job to part time, so got some spare time in my own project and some researches on Flex developments. I&#8217;m happy with that as I found more and more solutions in these days when I&#8217;m not pressed by full-time tasks as a major/lead developer and the only senior/firefighter for a team. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I changed my job to part time, so got some spare time in my own project and some researches on Flex developments. I&#8217;m happy with that as I found more and more solutions in these days when I&#8217;m not pressed by full-time tasks as a major/lead developer and the only senior/firefighter for a team.</p>

<p>What I get most excited is getting some more ideas on interface design methods for Flex/AIR applications. I&#8217;m not a designer, most of my time focus on Flex/Flash coding and I constantly feel bad especially interface design in Flex. Not only Flex itself has no good work flow yet designers can easy to work, also it very hard for team/companies to find a really good designer for Flex projects.</p>

<p>Ok, I&#8217;m talking here is another optional approach in interface design for Flex. See follow I did in my own Flex/Air project:</p>

<p><img class="aligncenter" title="Scale9Bitmap" src="http://www.neatfilm.com/post_images/09Jan/bitmap_result.png" alt="" width="224" height="142" /></p>

<p>Have you seen somewhere like this? Well, I don&#8217;t have designer on my own project, but like good designs when I write codes and testing, so I &#8216;borrowed&#8217; some graphics from CS4 for use temperorily. It looks beautiful isn&#8217;t it? I hate any bad ugly designs in development, man, it&#8217;s <strong>Flash platform</strong>. I like beauties when I&#8217;m working and that&#8217;s why I choose to work as my career.</p>

<p><span style="color: #000000;"><strong>Requirements to make it?</strong></span></p>

<p>The example above I used three images:</p>

<ul>
    <li>left highlight skin image</li>
    <li>right skin image</li>
    <li>dropdown button image</li>
</ul>

<p>Scale9Grid bitmap class, you can get from <a href="http://www.bytearray.org/?p=118">bytearray.org</a>. (I made some small modifications so its Scale9Bitmap class in this example. May write a new UIComponent-based class myself from scratch later when have time.)</p>

<p><strong>How to make it?</strong></p>

<p>The example above is the dock header, each one is a single object based on UIComponent. I show here how to make the right skin inside that component.</p>

<p>createChildren function, load bitmap with url:</p>

<p><img class="aligncenter" title="scale9 create children" src="http://www.neatfilm.com/post_images/09Jan/createChildren.png" alt="" width="517" height="280" /></p>

<p>Complete handler:</p>

<p><img class="aligncenter" title="scale9 complete" src="http://www.neatfilm.com/post_images/09Jan/complete_handler.png" alt="" width="505" height="160" /></p>

<p>updateDisplayList function:</p>

<p><img class="aligncenter" title="scale 9 update display" src="http://www.neatfilm.com/post_images/09Jan/updateDisplay.png" alt="" width="482" height="128" /></p>

<p>The component wouldn&#8217;t create bitmap until loader complete, then insert into bottom layer as its the background image. (In this example I put another skin image above so it will be inserted into layer 1 when the bottom layer has already added, that&#8217;s why I use a flag _rightSkinLoaded.)</p>

<p>The bitmap wouldn&#8217;t renderer until invalidation display list is called, which make maximum performance based on Flex framework. In updateDisplayList function, two skin images will be scaled with scale9Grid rectangles, that&#8217;s where the magic happens.</p>

<p>There&#8217;s one more thing, to get best result in my example, scale 9 bitmaps works better when positioning in pixels, I use int(xx) as followed:</p>

<p><img class="aligncenter" title="bitmap scale 9 pixel" src="http://www.neatfilm.com/post_images/09Jan/bitmap_pixel.png" alt="" width="488" height="123" /></p>

<p><strong>Discussion</strong></p>

<p>There already lots of approaches for interface design/skinning, like Flex/CS4 skinning kits, Degrafa. These approaches &#8216;work&#8217; but I myself much like use scale9grid bitmap inside component directly. Here&#8217;s what I think:</p>

<ul>
    <li>Any designer can make graphics design, can support developers easy to use this approach, in case of scale 9 grid can work perfect (I think most standard interface components?).</li>
    <li>Degrafa can be hard to &#8216;code&#8217; graphics result what designer expect, but image with scale9 rectangle easy.</li>
    <li>Less code (code lines after compiling) and better performance. If there&#8217;s tons of components in your application, you have to take care of performance. If you can, don&#8217;t use CSS skins for highly reused components.</li>
    <li>Bitmap don&#8217;t need to be embedded, which make less size of application and less compiling time if there&#8217;s many bitmaps.</li>
</ul>

<p>Of course, this is just an optional approach for Flex interface design, as scale 9 slices may not work in some designs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQLite as Service in AIR (Flash/Flex)</title>
		<link>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/</link>
		<comments>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 17:01:55 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flash Professional IDE]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=337</guid>
		<description><![CDATA[I introduce here is my approach (not fully complete framework), to use SQLite like an external service in AIR, in most simple way. The following code is how it to be used in Flash/Flex application: That simple? Sure it is. Don&#8217;t forget, in AIR applications, using SQLite we MUST use asynchronous connections for user experiences. [...]]]></description>
			<content:encoded><![CDATA[<p>I introduce here is my approach (not fully complete framework), to use SQLite like an external service in AIR, in most simple way.</p>

<p>The following code is how it to be used in Flash/Flex application:</p>

<p><img class="aligncenter" title="SQL code" src="http://www.neatfilm.com/post_images/09Jan/sqlite_code.png" alt="" width="449" height="201" /></p>

<p>That simple? Sure it is.</p>

<p>Don&#8217;t forget, in AIR applications, using SQLite we<strong> MUST use asynchronous connections</strong> for user experiences. The framework will do rest hard jobs for you.</p>

<p>Framework Features:</p>

<ul>
    <li>SQLConnection instances reused.</li>
    <li>SQLStatement instances reused.</li>
    <li>Statements executed in queue automatically, no extra control required.</li>
    <li>Dealing with SQLite locks inside framework.</li>
    <li>Feedback(result/fault) functions can be reused, similar with pureMVC&#8217;s handleNotifications.</li>
    <li>Support to run feedback functions not original object, i.e. a view sent a query then closed, after query complete, run feedback function in another object/view.</li>
    <li>All statement/connection objects managed and resources can be cleaned.</li>
</ul>

<p><img class="aligncenter" title="Sqlite workflow" src="http://www.neatfilm.com/post_images/09Jan/workflow.png" alt="" width="441" height="235" /></p>

<p><strong>SQLite Performance Best Practices
</strong></p>

<p>It&#8217;s important to get benefit of maximum performance of database, SQLite has its own specifications. One of them, Adobe has already documented, is the cached statements, cached statements can be reused and increase performance largely.</p>

<p>The second one, I didn&#8217;t see anyone mentioned it (maybe I missed), is the lock system of SQLite.</p>

<p>SQLite has a special lock system, have a look the figure followed:</p>

<p><img class="aligncenter" title="Sqlite lock" src="http://www.neatfilm.com/post_images/09Jan/sqlite_lock.png" alt="" width="476" height="303" /></p>

<p>Here&#8217;s several important rules about SQLite lock system:</p>

<ul>
    <li>A connection can have only one transaction (working statement) at a time.</li>
    <li>SQLite can have multiple read transactions(read statement) and one single write transaction(write statement) at the same time.</li>
    <li>When the write transaction working or waiting, no more new connections can work.</li>
    <li>The waiting write transaction will be executed only after all other read transactions complete.</li>
</ul>

<p>The third one, using SQLTransactionLockType.IMMEDIATE for write transaction can improve performance when necessary.</p>

<p>My solution implement first and second, the last one I didn&#8217;t find a good solution to use it in <strong>asynchronous connection mode</strong>, will talk it later.</p>

<p><strong>Framework Structure</strong></p>

<p><img class="aligncenter" title="SQLite framework structure" src="http://www.neatfilm.com/post_images/09Jan/structure.png" alt="" width="359" height="266" /></p>

<p>The framework include three major classes:</p>

<ul>
    <li>SQLManager</li>
    <li>ConnectionPool, manage and reuse connections for statements.</li>
    <li>StatementManager, add/remove statements.</li>
</ul>

<p><img class="aligncenter" title="SQLite classes" src="http://www.neatfilm.com/post_images/09Jan/classes.png" alt="" width="371" height="226" /></p>

<p>These object classes/interface used by the framework:</p>

<ul>
    <li>SQLiteStatement, after an operation finished, it run feedback based on caller and function(string). Feedback function can be different to the original view(object).</li>
    <li>SQLiteConnection</li>
    <li>CachedStatement, statement cannot to be run immediately will be cached as a CachedStatement in waiting list.</li>
    <li>ISQLResponder, optional interface for caller view/object.</li>
</ul>

<p><strong>Framework workflow</strong></p>

<ul>
    <li>Create instance for a database file (file can not exist even)</li>
    <li>Add statements when needed, statements will be initialized.</li>
    <li>View call for execute one or several statements with statement_id, set result/fault function, and flag whether need to ignore fault (if ignore, sqlite will continue to run waiting statements)</li>
    <li>SQLManager get statement instance, or cache your request to a waiting list if already used.</li>
    <li>SQLManager ask ConnectionPool to apply a SQLiteConnection for statement to execute.</li>
    <li>Statement try to execute, if SQLConnection not connected, waiting for that connection and execute.</li>
    <li>Statement completed/fault, call feedback function with statement_id (if asked), and execute next waiting statement if exist.</li>
</ul>

<p>The framework keep minimum instances of SQLConnection and SQLStatement, and easy to be removed as they&#8217;re managed for garbage collection.</p>

<p>I&#8217;m not going to publish source code right now as it&#8217;s not a complete framework yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MenuBar Skinning</title>
		<link>http://www.neatfilm.com/2009/01/19/menubar-skinning/</link>
		<comments>http://www.neatfilm.com/2009/01/19/menubar-skinning/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 07:25:40 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=325</guid>
		<description><![CDATA[The default menubar looks quite bad, I used half day to google and skin it. Ok, the result looks not too bad. Take out top menu item background. Add filter to top item label. Change top item rollover background. Set minimum width for top item. Set minimum width for drop down menu. Skinning for dropdown [...]]]></description>
			<content:encoded><![CDATA[<p>The default menubar looks quite bad, I used half day to google and skin it. Ok, the result looks not too bad.</p>

<p><img class="aligncenter" title="MenuBar" src="http://www.neatfilm.com/post_images/09Jan/menubar.png" alt="" width="511" height="238" /></p>

<ul>
    <li>Take out top menu item background.</li>
    <li>Add filter to top item label.</li>
    <li>Change top item rollover background.</li>
    <li>Set minimum width for top item.</li>
    <li>Set minimum width for drop down menu.</li>
    <li>Skinning for dropdown menu in CSS.</li>
</ul>

<p>Full example source code download <a href="http://www.neatfilm.com/flash/download/MenuBarSkin.zip">here</a>.</p>

<p>File list:</p>

<ul>
    <li>MenuBarSkin.mxml, with menu style and menuBar style especially fillColors, fillAlphas.</li>
    <li>AppMenuBar.as, extend MenuBar class, getMenuAt() to set minimum width for drop-down menu, updateBackground() was to remove the background.</li>
    <li>AppMenuItem.as, extend MenuBarItem, set top item label dropshadow filter and set minimum width for top item.</li>
    <li>MenuItemSkin.as, replace default up/down/over halo skin.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/19/menubar-skinning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Flash CS4-style Docking in Flex</title>
		<link>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/</link>
		<comments>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 00:37:21 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex SDK]]></category>
		<category><![CDATA[flash flex docking]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=299</guid>
		<description><![CDATA[Inspired by Degrafa, I spent couple of days to build a quick docking manager. It can add any component/containers into the list dynamically. Full source code download here. My working project with this docking manager:]]></description>
			<content:encoded><![CDATA[<p>Inspired by Degrafa, I spent couple of days to build a quick docking manager. It can add any component/containers into the list dynamically.</p>

<p>Full source code download <a href="http://www.neatfilm.com/flash/download/DockExample.zip">here</a>.</p>

<p style="text-align: center;"><img class="aligncenter" title="Docking" src="http://www.neatfilm.com/post_images/09Jan/dock.png" alt="" width="290" height="443" /></p>

<p style="text-align: left;">My working project with this docking manager:</p>

<p style="text-align: center;"><img class="aligncenter" title="Docking" src="http://www.neatfilm.com/post_images/09Jan/dock2.png" alt="" width="421" height="384" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AIR Mac-only Crashes</title>
		<link>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/</link>
		<comments>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 05:14:55 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=290</guid>
		<description><![CDATA[The team I recently working with mainly developing AIR application on Windows Vista, our designers using Macs though. AIR can be run both on Windows and Mac, but we experienced several Mac-only crashes. We have several Flex developers, I have to use some of my time review code for other developers even rewriting some of [...]]]></description>
			<content:encoded><![CDATA[<p>The team I recently working with mainly developing AIR application on Windows Vista, our designers using Macs though. AIR can be run both on Windows and Mac, but we experienced several Mac-only crashes.</p>

<p>We have several Flex developers, I have to use some of my time review code for other developers even rewriting some of buggy code. The designer working on Flex Builder for skinning will run the application on his Mac a few days a month, until he ran Flex Builder we knew the application got crash on Mac. I had to use several hours to find and fix the problem. A month and more later he opened his FB again and the application crash again.</p>

<p><strong>Crash Reasons?</strong></p>

<p>Totally three Mac-only crashes I fixed. Now I work remotely at home and using my own Macbook so there will no more &#8216;silent&#8217; Mac-only crash will happen. Here&#8217;s reasons I found which caused Mac-only crashes:</p>

<ul>
    <li>SQLite database object AMF3 <em>deserialization</em>, in a special case of object serialized with a single object to be stored several times into database table.</li>
    <li>A fault application menu was added.</li>
    <li>SQLite database, a write transaction was added into a function which has several read transactions running in parallel. Also, it seems several &#8216;select all&#8217; read transactions at the same time cause occasionally crash as well.</li>
</ul>

<p><strong>Avoid Mac-only Crashes</strong></p>

<ul>
    <li>If application need to be run on Mac, <strong>have at least one developer working on Mac</strong>.
Fixing a Mac-only bug after several weeks is hard than regular bugs. For agile development, bug should be find as soon as possible, if a month later find application cannot be run on Mac, a senior developer have to use at least several hours if unlucky.</li>
    <li>Be careful when working on <strong>SQLite database</strong>.
The first crash was because of an unsafe usage of reference, reuse a single object reference sometime cause unknown issues like this; for 3rd crash, although SQLite can have a single write transaction to be run at the same time of several read transactions, as &#8216;writer&#8217; will wait for an exclusive lock until all &#8216;readers&#8217; complete, SQLite engine inside AIR might not handler it correctly, at least on Mac.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AIR 1.5, SQlite now encrypted.</title>
		<link>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/</link>
		<comments>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 16:59:28 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=277</guid>
		<description><![CDATA[I have a long time searching for security on SQLite database, as far as I know encryption was a commercial extension for SQLite and not sure whether Adobe will implement it for AIR SQlite engine. It really a great news now Adobe AIR 1.5 support encrypted SQLite database. Thanks, Adobe AIR team. Using encryption with [...]]]></description>
			<content:encoded><![CDATA[<p>I have a long time searching for security on SQLite database, as far as I know encryption was a commercial extension for SQLite and not sure whether Adobe will implement it for AIR SQlite engine. It really a great news now Adobe AIR 1.5 support encrypted SQLite database. Thanks, Adobe AIR team.</p>

<p><a href="http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS8AFC5E35-DC79-4082-9AD4-DE1A2B41DAAF.html">Using encryption with SQL databases</a></p>

<p><a href="http://www.adobe.com/devnet/logged_in/rchristensen_lpolanco_air_1.5.html">Introducing Adobe AIR 1.5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3 Obfuscation and Decompiler Test</title>
		<link>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/</link>
		<comments>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 21:22:47 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flash Professional IDE]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=225</guid>
		<description><![CDATA[Shocked by Doug Mccuue&#8217;s post, I decided to have a test on obfuscation and decompiler together, to see how safe my own Flex/Air code bases. SWF Encrypt For a long time I was impressed by SWF Encrypt, although it&#8217;s not a real encryption, should be something interest if it can obfuscate code well for me. [...]]]></description>
			<content:encoded><![CDATA[<p>Shocked by <a href="http://dougmccune.com/blog/2008/09/27/if-you-steal-source-code-dont-ask-for-help-fixing-it/">Doug Mccuue&#8217;s post</a>, I decided to have a test on obfuscation and decompiler together, to see how safe my own Flex/Air code bases.</p>

<p><strong><a href="http://www.amayeta.com/software/swfencrypt/">SWF Encrypt</a></strong></p>

<p>For a long time I was impressed by SWF Encrypt, although it&#8217;s not a real encryption, should be something interest if it can obfuscate code well for me.</p>

<p><strong><a href="http://www.sothink.com/product/flash-decompiler-for-mac/index.htm">Sothink Decompiler</a></strong></p>

<p>In AS2 days I used to use the free <a href="http://www.nowrap.de/flare.html">Flare</a> written by Igor Kogan, it was a great tool to help to search where co-workers hide their code inside FLA files. But now I need a AS3 version it no longer support. I read a post by Lee Brimelow <a href="http://theflashblog.com/?p=391">about Sothink decompler</a> several months before, so I would like to give it a try.</p>

<p><strong>Test</strong></p>

<p>SWF Encrypt trial version let me try 25 times, I made a secure swf from my AIR swf file.</p>

<p>Sothink Decompiler can read my origin AIR swf file easily, include almost all assets and code packages. Unfortunately the trial version do not let me check source code.</p>

<p>I found code structure in Sothink quite clear and accurate matching my own code base. I decided to buy it as the price not a problem $79.</p>

<p><strong>Result</strong></p>

<p>From my original AIR swf file, Sothink can read almost all my code, that&#8230;.hell!</p>

<p>From secure AIR swf file, Sothink again, read most of my code, only several properties and function names hide.</p>

<p><strong>Conclusion</strong></p>

<p>First, the dark side, our code is definitely not safe.</p>

<p>Second, I do not feel SWF Encrypt doing its own job, I hope it can at least change my property/function names so even decompilers can take out all code, still hard to understand. SWF Encrypt really hide several properties/function names, but only very few of them.</p>

<p><span style="text-decoration: line-through;">Third, I found Sothink useful. Flex framework itself is a giant code base, Sothink decompiler code give some other code we cannot see and realize in MXML files.</span></p>

<p>Update: finty is right. I forgot Flex compiler can generate source code itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AIR Application Syslog with SQLite</title>
		<link>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/</link>
		<comments>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 02:38:35 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=190</guid>
		<description><![CDATA[In AIR (Flex/Flash) application, syslog support might be very useful for QA/developers also can be helpful for end user as well. I wrote some fast code for my personal project Dailytasks on this (and another more complex SQLite database with transaction manager) during this long weekend. You can download source code from here. (Need some [...]]]></description>
			<content:encoded><![CDATA[<p>In AIR (Flex/Flash) application, syslog support might be very useful for QA/developers also can be helpful for end user as well. I wrote some fast code for my personal project <a href="http://dailytasks.net/">Dailytasks</a> on this (and another more complex SQLite database with transaction manager) during this long weekend.</p>

<p>You can download source code from <a href="http://www.neatfilm.com/flash/download/sqlite_log.zip">here</a>. (Need some tweaks to fit your own application for sure.)</p>

<p>Here&#8217;s how it works:</p>

<ul>
    <li>(Run once and comment it out) Create syslog database file and table. (I use some code to create and run once only, when I need update my table structure, rebuild database again.)</li>
    <li>Initialize SyslogService instance in preinitialize process of application. (it will open SQLConnection and compile statement to be used later.)</li>
    <li>Call static function from any points, i.e.:
<ul>
    <li><code>SyslogService.log(SyslogLevel.INFO, 'Application start.');</code></li>
</ul>
</li>
    <li>If statement is executing, push log data into stack and insert after.</li>
</ul>

<p>Update (September 3):</p>

<p style="padding-left: 30px;">I don&#8217;t have time to test completely. If you got database open error, just add open listener before execute the statement. Code is just simple like this.</p>

<p style="padding-left: 30px;"><code>if(!sqlConnection.connected)</code></p>

<p style="padding-left: 60px;"><code>sqlConneciton.addEventListener ...</code></p>

<p style="padding-left: 30px;">Because the connection and statement will be reused all the time, you need to detect only once.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite Notes</title>
		<link>http://www.neatfilm.com/2008/06/13/sqlite-notes/</link>
		<comments>http://www.neatfilm.com/2008/06/13/sqlite-notes/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 18:56:45 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex SDK]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=72</guid>
		<description><![CDATA[Execute statement Every statement has an associated connection object, a statement represents a single &#8216;compiled&#8217; SQL statement. There&#8217;re two methods to execute SQLStatement instance in AIR, one execute a single statement each time, another use .begin() .commit() to execute multiple statements, as a transaction. For SQLite engine, they both transaction, the single statement operates in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Execute statement</strong></p>

<p>Every statement has an associated connection object, a statement represents a single &#8216;compiled&#8217; SQL statement. There&#8217;re two methods to execute SQLStatement instance in AIR, one execute a single statement each time, another use .begin() .commit() to execute multiple statements, as a transaction. For SQLite engine, they both transaction, the single statement operates in autocommit mode by default.</p>

<p>SQL statement execution process:
<code> Statement+SQL -&gt; Compilation -&gt; Byte Code (with parameters) -&gt; execution -&gt; Finalization</code></p>

<p>Use parameters for statements is highly recommended. One important benefit Adobe might not documented: SQLite takes care of escaping the string values binding to parameters, helping avoid syntax errors and SQL injection attacks, i.e, it will convert &#8216; to &#8221;.</p>

<p><strong>Transaction and Locks</strong></p>

<ul>
    <li>Multiple read transactions (SELECT), one single write transaction (INSERT/UPDATE/DELETE) at a time.</li>
    <li>When write transaction is writing (exclusive locked), no new transactions can connect.</li>
    <li>Write transaction will wait for any running read transactions to finish before writing.</li>
</ul>

<p>Each transaction (or SQLStatement execution in autocommit mode) transit from one state to another state.</p>

<p>A default SELECT statement run in path as followed:
<code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>Two SELECT statements grouped with .begin() and .commit() in a single transaction:</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>Two SELECT statements run in turn:</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>A write transaction (i.e. UPDATE) by default (autocommit mode):</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Reserved -&gt; Pending -&gt; Exclusive locked(commit) -&gt; Unlocked</code></p>

<p>A write transaction with &#8216;BEGIN IMMEDIATE&#8217;:</p>

<p><code>Reserved -&gt; Pending -&gt; Exclusive locked(commit) -&gt; Unlocked</code></p>

<p>The &#8216;Reserved&#8217; state is a tricky state that may a place to improve performance. It actually store modifications in a memory cache, and create a rollback journal file for possible crash recovery. In this state the write transaction get real work done without affecting other read transactions. That&#8217;s how &#8216;multiple reader, one writer&#8217; works.</p>

<p>After the write transaction get it work done, it begins trying get a Pending lock to move to Exclusive commit state, where (Pending) no more new read/write transactions (they have to wait in queue), the write transaction need to wait any other transactions still working to finish. Only after anything else cleared, this transaction enter into Exclusive state.</p>

<p>The &#8216;Exclusive&#8217; state is to flush the modifications from cache to database file.</p>

<p>SQLConnection has a property cacheSize that affect write transaction. In &#8216;Reserved&#8217; state if page cache fills up, it have to move to &#8216;Exclusive&#8217; state before finish its own task. The bigger cacheSize the more modified pages can store and minimize the time to be used in &#8216;Exclusive&#8217; state. (sqlite_analyzer can dump detailed statistics helpful for adjusting cacheSize)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/06/13/sqlite-notes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Personal Thoughts, Future Changes in Flash Community for Developers?</title>
		<link>http://www.neatfilm.com/2008/03/12/personal-thoughts-future-changes-in-flash-community-for-developers/</link>
		<comments>http://www.neatfilm.com/2008/03/12/personal-thoughts-future-changes-in-flash-community-for-developers/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 19:55:07 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/2008/03/14/personal-thoughts-future-changes-in-flash-community-for-developers/</guid>
		<description><![CDATA[Two years ago when ActionScript 3 introduced to Flash community, Flex 2 was the first citizen of next generation of Flash platform, before Flash CS3 released almost a year later (count in Flex 2 beta versions). I don&#8217;t know how many percents of former Flash developers has already worked with AS3 today, but one thing [...]]]></description>
			<content:encoded><![CDATA[<p>Two years ago when ActionScript 3 introduced to Flash community, Flex 2 was the first citizen of next generation of Flash platform, before Flash CS3 released almost a year later (count in Flex 2 beta versions). I don&#8217;t know how many percents of former Flash developers has already worked with AS3 today, but one thing at least, Flash developers not only excited by the new generation robust AS3 language, but also confused and complained. Some Flash developers argued Flex frameworks, are those Flex applications over-engineering? Why a single Flex component asking for big number of kbytes which not included in RSL? Some voices also come from another side of hill, the mainstream of Flex developers, former Java developers found themselves quite comfortable with Flex frameworks, has some opposite opinions.</p>

<p>What happens to Flash community for Flash developers? What&#8217;s the direction of future Flash developments?</p>

<p>(&#8216;Flex&#8217; means Flex framework projects in this post not include Flex pure actionscript projects)</p>

<p><strong>Flex changing Flash developments</strong></p>

<p>When ActionScript 3 came with Flex 2 two years before, there&#8217;s a strong signal from Adobe, Adobe has great interests to grasp methodologies from Java world, Agile developments into the new generation of Flash. The new AS3 API then has two parts from Adobe:</p>

<ul>
<li><p>Flash Player API. The same part that Flash developers coding in AS2 with Flash IDE (technically new VM for sure), now what Flash developer relying on using Flash CS3 IDE (there&#8217;s still components in Flash CS3, I wonder whether they really useful).</p></li>
<li><p>Flex framework. Visual components and layout containers, styling, event/handler pairs, utility classes, data collections, service/remoting classes, code templates/code injection with MXML scripts and meta data.</p></li>
</ul>

<p>I know some Flash developers, likely refuse to touch the AS3 Flex framework API, refuse the heavy weight kbytes for web applications. Though it has to say, Flex changing Flash developments.</p>

<blockquote>
  <p>The more Flex accepted by the industry, the more it changes Flash developments even without using Flex.</p>
</blockquote>

<p>In sport games, when a challenger got higher score than a former champion, the latter will lose his gold. The only choice he had to fight for another higher score to regained the winner position. Today Flex was accepted by the market, and most important, for clients and end users, Flex equals to Flash, both Flash SWF files running with Flash player VM or AIR. So some situations will be, if something can be done well in Flex, like better usability,  accessibility, functionality, will be requested by clients: &#8216;I like the way of that Flash, do this for me can you?&#8217;</p>

<p>So in some means, Flex pushing Flash applications to be more complicated than before. The more complex, the more code, and better light-weight architecture, with reasonable design patterns, will be necessary for lots of future AS3 Flash applications.</p>

<p>Second, Flex will change Flash projects by developers. The community now not only has traditional Flash developers, Flex developers, but also between them, there will be a number of Flash &amp;&amp; Flex developers. When these developers join in a Flash project team, experiences from Flex developments and some techniques used in Flex framework which can be found from source code, will be introduced into Flash AS3 projects. For example, early last year I read a mailing list post from a developer of Adobe Flex team (should be James Ward if not wrong), said &#8216;Flex has better solutions to deal with text renderering&#8217;, so when a Flash project has the needs of text renderering optimization, how about to get some ideas from Flex framework source code how Adobe teams improved that?</p>

<p><strong>Flex acceptance</strong></p>

<p>Flex has been accepted well in the industry which no one can ignore.</p>

<ul>
<li><p>Development teams favor more Flex.</p>

<ul>
<li>MXML and meta data, better readability, less code to maintain</li>
<li>Force developers to code under predefined architecture, components/containers, event/handler, developers can be replaced easier by new members.</li>
<li>Possibility for test-driven development and continuous integration, depends on team members&#8217; experiences and time.</li>
</ul></li>
<li><p>Lower budget required.</p>

<ul>
<li>No need developer hours/QA for components/containers offered by Adobe.</li>
<li>Fast mock-up with MXML design view, easy to throw away if not fit.</li>
<li>Flex SDK is free and Flex Builder 3 free for educations, means more cheap developers in the future.</li>
</ul></li>
<li><p>Accepted by market.</p>

<ul>
<li>There&#8217;re many cases where functionality more important than preloading speed even remote websites.</li>
<li>Local networked enterprise applications don&#8217;t care how much kbytes.</li>
<li>AIR applications don&#8217;t care size.</li>
</ul></li>
</ul>

<p><strong>Future Changes?</strong></p>

<p>So Flex has lots of benefits that Flash project couldn&#8217;t have today, what about the old Adobe rumor? Flash IDE for designers, Flex for developers?</p>

<p>I never agree with this. Flash development will not, and never can be replaced by Flex (framework) wholly.</p>

<ul>
<li>Limitation of Flex framework</li>
</ul>

<p>Flex framework was planned for enterprise solutions, even today Internet quite faster than several years before, even Flex 3 introduced RSL solution to reduce kbytes absolutely, in many case, preloading speed can still be a problem to end users, would lose their satisfaction whatever realized or not.</p>

<p>Other cases if end users change their habits, say, some guys using iPhone/iPod more often? Most of Flex applications will be immediately not runnable in those devices. Techniques used by Flex framework to improve development effectiveness are double-edged sword, such as MXML/meta data, which auto-generated source code, automatic components/containers size-measurement, will consume more kbytes/memory than real necessary.</p>

<ul>
<li>Open source light-weight Flash framework for better, faster, lighter Flash applications</li>
</ul>

<p>There&#8217;re already some open source AS3 framework emerged, some for dedicated usage like PV3D, some for light-weight architecture like pureMVC. I think there will be finally one or two mainstream open source Flash frameworks to be used as light-weight alternate to Flex framework (i.e. heavy components like DataGrid not necessary for most of Flash projects), lighter and more freedom to build Flash applications with Flash IDE or Flex pure ActionScript projects.</p>

<p>Open source framework could be faster to change than Flex framework because of less backward compatibility required, result will be Flex framework possibly sometimes get contributions from open source Flash framework by community.</p>

<p>RSL solution for open source Flash framework? How about share unique URLs, i.e. http://osflash.org/share/osrsl_01.swf.</p>

<p>There will be also needs of some external development tools, such as dynamic mock-up, open source automation test tools to be used to improve effectiveness in Flash developments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/03/12/personal-thoughts-future-changes-in-flash-community-for-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
