<?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>NAS.C.O.D.E</title>
	<atom:link href="http://nascode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nascode.com</link>
	<description>Visualization is Fun!</description>
	<lastBuildDate>Sun, 07 Feb 2010 14:26:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nexus One alias Google Phone</title>
		<link>http://nascode.com/2010/02/07/nexus-one-alias-google-phone/</link>
		<comments>http://nascode.com/2010/02/07/nexus-one-alias-google-phone/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 14:25:10 +0000</pubDate>
		<dc:creator>Inas Luthfi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[handphone]]></category>
		<category><![CDATA[smartphone]]></category>

		<guid isPermaLink="false">http://nascode.com/?p=58</guid>
		<description><![CDATA[iPhone, siapa yang tak kenal iPhone? Sebuah smartphone revolusioner ciptaan Apple yang mewujudkan visi Steve Jobs akan sebuah telepon genggam. iPhone, smartphone yang mengancam market share Nokia dan RIM dalam pasaran ini hanya membutuhkan beberapa tahun untuk mencapai kesuksesan.  It is simply amazing!
Apa rahasianya?
Apple telah membuat revolusi dengan AppStore untuk iPhone, menyediakan pasar untuk <a href="http://nascode.com/2010/02/07/nexus-one-alias-google-phone/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>iPhone, siapa yang tak kenal iPhone? Sebuah smartphone revolusioner ciptaan Apple yang mewujudkan visi Steve Jobs akan sebuah telepon genggam. iPhone, smartphone yang mengancam market share Nokia dan RIM dalam pasaran ini hanya membutuhkan beberapa tahun untuk mencapai kesuksesan.  It is simply amazing!</p>
<div id="attachment_52" class="wp-caption alignnone" style="width: 460px"><a href="http://nascode.com/wp-content/uploads/2010/02/20100105smartphone3a.jpg"><img class="size-full wp-image-52 " title="smartphone chart dari Appleinsider" src="http://nascode.com/wp-content/uploads/2010/02/20100105smartphone3a.jpg" alt="smartphone chart dari Appleinsider" width="450" height="288" /></a><p class="wp-caption-text">smartphone chart dari Appleinsider</p></div>
<p>Apa rahasianya?</p>
<p>Apple telah membuat revolusi dengan AppStore untuk iPhone, menyediakan pasar untuk pengembang aplikasi menawarkan produknya. Hasilnya terbukti sangat sukses. Nokia mengikuti langkah Apple dengan membuat Ovi Store, begitu pula dengan RIM, dan terakhir adalah Windows Mobile Market  dari Microsoft. Inilah sebuah revolusi cara menawarkan aplikasi third-party untuk mobile phone.</p>
<p>Google pun tak tinggal diam, semula raksasa di bidang search engine, kini mulai merambah pasar smartphone dengan <a href="http://www.google.com/phone" target="_blank">Google Nexus One</a> dan sistem operasi mobile yang tertanam didalamnya yaitu <a href="http://www.android.com/" target="_blank">Android</a>. Nexus One dibuat bekerja sama dengan HTC, sebuah perusahaan dengan fokus ke pembuatan smartphone berkualitas tinggi. Hasilnya memang (tampak) keren, sayangnya penjualan di awal 2010 masih meragukan, terlebih ada isu customer servicenya masih belum bagus.<span id="more-58"></span></p>
<p>Untuk developer seperti saya, jujur sangat tertarik membelinya untuk diutak-atik. Terlebih alur pengembangan aplikasi hingga rilis ke <a href="http://www.android.com/market/" target="_blank">Android Market</a> lebih simpel, misalnya tak perlu melalui proses birokratis untuk menjadi developer seperti layaknya untuk menjadi developer aplikasi third-party iPhone. Untuk pengembangan aplikasi di iPhone kata teman-teman saya tiap tahunnya harus bayar membership, dan formalnya adalah mengembangkan aplikasi iPhone harus memakai OSX dulu (ada cara memang supaya tak butuh OSX).</p>
<p>Terlebih lagi, sebagai Flash developer, Adobe telah menyatakan akan mendukung smartphone ini <a href="http://www.adobe.com/devnet/flashplayer/articles/mobile_demos_fp10.1.html" target="_self">memainkan content flash dalam rilis Flash Player berikutnya</a>. Okelah kalau begitu.</p>
<p>Sayang sekali smartphone ini belum resmi beredar di Indonesia, jadi tampaknya sabar dulu aja yah.</p>
<div id="attachment_54" class="wp-caption alignnone" style="width: 476px"><a href="http://nascode.com/wp-content/uploads/2010/02/google_nexus_one_1.jpg"><img class="size-full wp-image-54" title="Google Nexus One Unavailable" src="http://nascode.com/wp-content/uploads/2010/02/google_nexus_one_1.jpg" alt="Google Nexus One Unavailable" width="466" height="467" /></a><p class="wp-caption-text">Google Nexus One Unavailable</p></div>
<p>Untuk melihat video promosi dan apa saja kelebihan Google Nexus One ini cek <a href="http://www.youtube.com/profile?user=googlenexusone" target="_blank">kesini</a>. Hati-hati banyak video cuci otak menjadi penggemar Nexus One <img src='http://nascode.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nascode.com/2010/02/07/nexus-one-alias-google-phone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Embedding Asset at Compile Time in Pure AS3 Project</title>
		<link>http://nascode.com/2010/02/01/embedding-asset-at-compile-time-in-pure-as3-project/</link>
		<comments>http://nascode.com/2010/02/01/embedding-asset-at-compile-time-in-pure-as3-project/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:38:32 +0000</pubDate>
		<dc:creator>Inas Luthfi</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Asset]]></category>
		<category><![CDATA[Embedding]]></category>

		<guid isPermaLink="false">http://nascode.com/?p=8</guid>
		<description><![CDATA[When we are doing pure AS3 project especially game, somehow we need to put our game art asset into the game. We can achieve this using either runtime asset loading or embedding asset at compile time. If we are developing under Flash IDE, then embedding asset can be done automatically. Just import the assets to library, <a href="http://nascode.com/2010/02/01/embedding-asset-at-compile-time-in-pure-as3-project/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>When we are doing pure AS3 project especially game, somehow we need to put our game art asset into the game. We can achieve this using either runtime asset loading or embedding asset at compile time. If we are developing under Flash IDE, then embedding asset can be done automatically. Just import the assets to library, and it will be embedded next time you publish your SWF. Even better, Flash IDE has many options to compress the embedded images or resampling audio in the library. However, these options are some reasons why on large size FLA project, Flash IDE publish SWF so slow. Compressing image and resampling audio takes a while, plus Flash IDE compiler is not fast enough.</p>
<p>Some Flashers nowadays prefer to embed asset manually without Flash IDE in order to avoid frustation when publishing swf in a large project, especially when we should test our code a lot. Using Flex Builder/FDT/Flashdevelop for example will fasten compile time, debugging support, and also offer excellent code-hinting. But unfortunately, embedding asset is not as easy as using Flash IDE, now we must write more code to achieve it.</p>
<p>When building large application, it is often beneficial when you split up SWF into smaller pieces, and load it at runtime,  this method is called <em>runtime asset loading</em>, i will not discuss it now. Here i will only write about embedding asset at compile time using pure AS3, i will not discuss embedding asset using MXML tag or using CSS on Flex Framework. For references i am using <a title="Cool Book" href="http://www.amazon.com/Essential-ActionScript-3-0-Colin-Moock/dp/0596526946" target="_blank">Moock&#8217;s book</a> especially chapter 28 &#8220;Loading External Display Assets&#8221; on the last part, and also some good articles on the net from fellow AS3 developers.</p>
<p><span id="more-8"></span></p>
<h2>Basic Embedding</h2>
<p>In first method we will use <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[Embed]</span> metadata supported by <em>mxmlc </em>command-line compiler for embedding asset.  Before using it, i must warn you that using <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[Embed]</span> will not give you any access to script on embedded SWF like on MovieClip asset. It is ideal for graphical and animated asset but not more, see <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html" target="_blank">Adobe Resource Center</a> for more information. As a personal note, i discourage the use of timeline script except for really simple task such as stopping and playing <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">MovieClip</span>.</p>
<p>When using <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[Embed]</span> metadata, you can assign it in <em>instance-variable definition level</em> or <em>class definition level</em>.</p>
<h3>Instance-Variable Definition Level</h3>
<pre class="brush: as3;">
[Embed (source = &quot;path&quot;)]
var ClassWithEmbed:Class;
// compiler will create new Class as embedded asset representation at compile-time, then you can instantiate  new object
var newObject:* = new ClassWithEmbed();
</pre>
<p>replace &#8220;path&#8221; with relative path or absolute path.</p>
<p>You may change * datatype with specific Class, but what is the real datatype for embedded asset? AS3 reflection method will tell us:</p>
<pre class="brush: as3;">describeType(newObject).extendsClass</pre>
<p>the method will eventually tell you what <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">newObject</span>&#8217;s type is actually. If it is bitmap asset it will be a class that extends from <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">mx.core.BitmapAsset</span>. <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">BitmapAsset</span> extends <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">FlexBitmap</span> then extends <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">Bitmap</span>. There is a problem if you wish to create smallest SWF as possible because you just added <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">mx.core</span> Flex Classes which is overkill. You can turn on <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">link-report</span> <em>mxmlc</em> compiler option to see by yourself just how many class definition included when adding Flex Classes. See this <a href="http://blog.brokenfunction.com/2009/03/16/how-to-remove-flex-libraries-completely-from-your-as3-project/" target="_blank">useful blog</a> to know more about this. <a href="http://www.senocular.com/flash/tutorials/as3withmxmlc/" target="_blank">Senocular</a> has tutorial on <em>mxmlc</em>, if you wish to know what options <em>mxmlc</em> compiler has.</p>
<h3>Class Definition Level</h3>
<p>To avoid problem in <em>instance-variable definition level</em>, we can opt to <em>class definition level</em>. Look at code below, in other word, we extends specific Class for referencing embedded asset. Below we create GIFBitmap Class to extends Bitmap Class since we are embedding .gif image. After that we can use GIFBitmap Class to instantiate new objects.</p>
<pre class="brush: as3;">
package
{
    import flash.display.Bitmap;

    [Embed (source = &quot;asset/some.gif&quot;)]
    public class GIFBitmap extends Bitmap{}
}
</pre>
<p>class definition level for embedding asset is a better way to do, since there is a concern on <a href="http://www.tage7.net/devblog/2010/01/15/as3-embedding-assets-memory-leak/" target="_blank">memory leak could happening</a> if you use metadata tag directly on instance-variable level.</p>
<p>AS3 will automatically &#8220;know&#8221; these types of files:</p>
<ul>
<li>JPG, for class definition level, extends from flash.display.Bitmap</li>
<li>GIF, for class definition level, extends from flash.display.Bitmap</li>
<li>PNG, for class definition level, extends from flash.display.Bitmap</li>
<li>SVG, for class definition level, extends from flash.display.Sprite</li>
<li>MP3, for class definition level, extends from flash.media.Sound</li>
<li>TTF, there is special case with font embedding</li>
<li>SWF, you must use variable-instance level, but for the symbol inside SWF, you can extends from Sprite or MovieClip</li>
</ul>
<h3>Embedding Bitmap</h3>
<p>You may embed jpg, png, and gif files without so much hassle. If you use instance-variable method, the resulting class would be from  mx.core.BitmapAsset.</p>
<pre class="brush: as3;">
// instance-variable level
[Embed (source = &quot;asset/any.png&quot;)]
var AssetClass:Class;
// intantiation
var temp:* = new AssetClass(); // temp is a class of mx.core.BitmapAsset
</pre>
<p>Class-definition method is preferable if you want smallest possible SWF  size. Your subclass should extends from Bitmap.</p>
<pre class="brush: as3;">
// class-definition level
package
{
    import flash.display.Bitmap;

    // extends Bitmap, not mx.core.BitmapAsset
    [Embed (source = &quot;asset/somepng.png&quot;)]
    public class PNGBitmap extends Bitmap
    {
        public function PNGBitmap(){}
    }
}
</pre>
<h3>Embedding Sound</h3>
<p>You may embed MP3 file. If you use instance-variable method, the resulting class would be from <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">mx.core.SoundAsset.</span></p>
<pre class="brush: as3;">
// instance-variable level
[Embed (source = &quot;asset/any.mp3&quot;)]
var AssetClass:Class;
// intantiation
var temp:* = new AssetClass(); // temp is a class of mx.core.SoundAsset
temp.play(); // play the cool sound
</pre>
<pre class="brush: as3;">
// class-definition level
package
{
    import flash.media.Sound;
    // extends Sound
    [Embed (source = &quot;asset/cool.mp3&quot;)]
    public class SoundTrack extends Sound
    {
        public function SoundTrack(){}
    }
}

// try to instantiate it
var sound:flash.media.sound = new SoundTrack();
sound.play();
</pre>
<h3>Embedding Old Swf (targeting below Flash Player 9)</h3>
<p>When you are developing newer swf targeting Flash Player 9 and later, it is better that you use SWC Embedding method, since IDE such as FlashDevelop or Flex/Flash builder can see through the SWC and lists all of the symbol inside that swc.</p>
<p>Now for embedding the SWF, if you wish to embed entire SWF, unfortunately you must use instance-variable method and for the datatype for the class will be <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">mx.core.MovieClipLoaderAsset</span>, meaning you must go with adding Flex Library. There is a panacea though, by using binary file method discussed later.</p>
<pre class="brush: as3;">
[Embed (source = &quot;star.swf&quot;)]
var SWFAsset:Class;
var swf:* = new SWFAsset();
addChild(swf);
</pre>
<p>If you wish to reference MovieClip or Sprite on the swf, you can use class definition method, remember to add linkage id on the symbol you wish to be referenced.</p>
<pre class="brush: as3;">
package
{
    import flash.display.*;
    import flash.utils.describeType;

    [Embed (source=&quot;asset/star.swf&quot;, symbol=&quot;Star&quot;)]
    public class SWFAsset extends Sprite
    {
        public function SWFAsset(){}
    }
}
</pre>
<p>You can actually use SWF embedding and <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">getDefinition()</span> method to get the symbol reference. But it is better to use SWC embedding though.</p>
<h3>Embedding Anything</h3>
<p>Yes, you can embed just anything if you use binary file embedding. You can embed text files, xml, or whatever as long as you can parse it. AS3 XML class can parse ByteArray to XML for example. In fact if you loaded SWF this way, you may not use Flex Library.</p>
<pre class="brush: as3;">
package
{
    import flash.utils.ByteArray;

    [Embed (source=&quot;asset/star.swf&quot;, mimeType=&quot;application/octet-stream&quot;)]
    public class ByteAsset extends ByteArray
    {
        public function SWFAsset(){}
    }
}

// then use it on somewhere
import flash.display.Loader

var loader:Loader = new Loader();
loader.loadBytes(new ByteAsset());
addChild(loader);
</pre>
<p>If you read SWF binary, you can actually use SWF embedding and getDefinition() method to get the  symbol reference too.</p>
<h2>SWC Embedding</h2>
<p>Actually SWC is like a compiled library file plus the class definition. For Action Script 3, it is quite common to see custom-made library developed by people to be distributed in SWC, but more than that, SWC can also be made to package asset files. Flash IDE can publish SWC instead of just SWF, and so we can add the SWC to our library path and &#8220;pull&#8221; assets from our SWC using class instantiation. This method is also preferable workflow of Flash IDE and Flex Builder/Flash Builder/FlashDevelop integration. See also <a href="http://www.airtightinteractive.com/news/?p=327" target="_blank">Airtightinteractive blog</a> for more information about this workflow and <a href="http://blog.geewa.com/post/2009/03/16/Integrating-Flash-Professional-and-Flex-Builder-Using-SWC.aspx">Geewa blog</a> for strategy using the SWC.</p>
<p>For Flash IDE to generate SWC instead of just SWF, you must enable it on Publish Settings &gt; Flash &gt; Export SWC. Do not forget to add linkage id on flash symbol you want to instantiate on Actionscript 3. Set the base Class to <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">MovieClip</span> or <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">Sprite.</span></p>
<p>Then add the SWC, it will be easier if you use Flex Builder or FlashDevelop. If you named your linkage <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">Star</span> that use <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">Sprite</span> as a base class for example, you may use it directly:</p>
<pre class="brush: as3;">
var temp:Sprite = new Star();
aDisplayContainer.addChild(temp);
</pre>
<p>For font embedding and more things including Flex SDK related embed method, you may see <a href="http://www.gskinner.com/talks/flexlovesflash/" target="_blank">Grant Skinner&#8217;s Presentation</a> and of course article on <a href="http://www.adobe.com/devnet/flash/articles/embed_metadata_04.html" target="_blank">Flash Developer Center</a>. Embedding binary file is another approach to embed arbitrary file, but maybe that is the topic for future post <img src='http://nascode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://nascode.com/2010/02/01/embedding-asset-at-compile-time-in-pure-as3-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://nascode.com/2010/01/25/hello-world/</link>
		<comments>http://nascode.com/2010/01/25/hello-world/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:29:13 +0000</pubDate>
		<dc:creator>Inas Luthfi</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Hello World]]></category>

		<guid isPermaLink="false">http://nascode.com/?p=1</guid>
		<description><![CDATA[Hello there! Since Wordpress installation add mandatory "Hello world!" post, i thought it is better to start the blog with editing this post's content (call me lazy :P). Proper introduction should be in order, so here i am, welcome to my brand new blog.]]></description>
			<content:encoded><![CDATA[<p>Hello there! Since Wordpress installation add mandatory &#8220;Hello world!&#8221; post, i thought it is better to start the blog with editing this post&#8217;s content (call me lazy <img src='http://nascode.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). Proper introduction should be in order, so here i am, welcome to my brand new blog.<span id="more-1"></span></p>
<p>My name is Inas Luthfi  and i am native Indonesian, Indonesia is a nice country with beautiful scenery and wonderful climate, just make sure you are not trapped on the major cities, there is heavy air pollution there to kill you for sure. Granted, i live as a programmer who favor graphic programming, visualization stuff, and also building game. I work at a creative studio,  <a href="http://www.nightspade.com">Nightspade studio</a>, there are many &#8216;artistic&#8217; people there, but i love working with them. For now i am focusing my skill on actionscript3 programming (that&#8217;s Flash Platform for you), and since i somewhat love 3D stuff, i am also learning about it.</p>
<p>I wanted a blog for documenting technical stuff and personal stuff since a long time ago, alas, i do not have enough time for building blog, but now i am building it! So, expect to see some development experiment that i do in here mainly focusing on Flash Platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://nascode.com/2010/01/25/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
