<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Shang Liang</title>
	
	<link>http://shang-liang.com/blog</link>
	<description>Life in a Flash</description>
	<pubDate>Mon, 02 Nov 2009 03:41:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/shang-liang/feed" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Box2D Tutorial</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/TSicRd-UNK4/</link>
		<comments>http://shang-liang.com/blog/box2d-tutorial/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 03:41:05 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=191</guid>
		<description><![CDATA[I gave a mini tutorial on Box2D during A-SFUG meeting. You can download it here. Have fun!
]]></description>
			<content:encoded><![CDATA[<p>I gave a mini tutorial on Box2D during <a title="another singapore flash user group" href="http://www.a-sfug.com">A-SFUG</a> meeting. You can <a href="http://www.a-sfug.com/wp-content/uploads/2009/11/box2d.zip">download it here</a>. Have fun!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=TSicRd-UNK4:YHSIAh1PfG0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=TSicRd-UNK4:YHSIAh1PfG0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=TSicRd-UNK4:YHSIAh1PfG0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=TSicRd-UNK4:YHSIAh1PfG0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=TSicRd-UNK4:YHSIAh1PfG0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=TSicRd-UNK4:YHSIAh1PfG0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=TSicRd-UNK4:YHSIAh1PfG0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/TSicRd-UNK4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/box2d-tutorial/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/box2d-tutorial/</feedburner:origLink></item>
		<item>
		<title>Box2D data visualization</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/kh94b-sL1S4/</link>
		<comments>http://shang-liang.com/blog/box2d-data-visualization/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 06:11:40 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=184</guid>
		<description><![CDATA[Data visualization for join the pact campaign. Click to view.

]]></description>
			<content:encoded><![CDATA[<p>Data visualization for join the pact campaign. Click to view.</p>
<p><a href="http://staging.jointhepact.com/presentation"><img class="alignnone size-full wp-image-187" title="data_visualization_box2d" src="http://shang-liang.com/blog/wp-content/uploads/2009/10/data_visualization_box2d.jpg" alt="data_visualization_box2d" width="592" height="338" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=kh94b-sL1S4:4K2cE0rsfx0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=kh94b-sL1S4:4K2cE0rsfx0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=kh94b-sL1S4:4K2cE0rsfx0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=kh94b-sL1S4:4K2cE0rsfx0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=kh94b-sL1S4:4K2cE0rsfx0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=kh94b-sL1S4:4K2cE0rsfx0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=kh94b-sL1S4:4K2cE0rsfx0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/kh94b-sL1S4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/box2d-data-visualization/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/box2d-data-visualization/</feedburner:origLink></item>
		<item>
		<title>Fun with Box2D</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/-i7GU6ZZFnU/</link>
		<comments>http://shang-liang.com/blog/fun-with-box2d/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 06:47:24 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=179</guid>
		<description><![CDATA[Messing around with Box2D. Quite fun.

]]></description>
			<content:encoded><![CDATA[<p>Messing around with Box2D. Quite fun.</p>
<p><a href="http://shang-liang.com/collaboration/shang/box2d/"><img class="alignnone size-full wp-image-180" title="box2d" src="http://shang-liang.com/blog/wp-content/uploads/2009/10/box2d.jpg" alt="box2d" width="400" height="223" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=-i7GU6ZZFnU:oMsBgpRA9mU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=-i7GU6ZZFnU:oMsBgpRA9mU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=-i7GU6ZZFnU:oMsBgpRA9mU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=-i7GU6ZZFnU:oMsBgpRA9mU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=-i7GU6ZZFnU:oMsBgpRA9mU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=-i7GU6ZZFnU:oMsBgpRA9mU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=-i7GU6ZZFnU:oMsBgpRA9mU:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/-i7GU6ZZFnU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/fun-with-box2d/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/fun-with-box2d/</feedburner:origLink></item>
		<item>
		<title>Sharing some good PHP stuff: Simple HTML DOM Parser</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/E-wSJ1Z6hIg/</link>
		<comments>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 10:46:47 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=173</guid>
		<description><![CDATA[Most of my Flash projects use XML as &#8220;database&#8221; and PHP is my preferred server script.  I found Simple_HTML_DOM Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is [...]]]></description>
			<content:encoded><![CDATA[<p>Most of my Flash projects use XML as &#8220;database&#8221; and PHP is my preferred server script.  I found <a href="http://simplehtmldom.sourceforge.net/">Simple_HTML_DOM</a> Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is that the scripts written for PHP 4 are not compatible with PHP 5.</p>
<p>Simple HTML DOM Parser is designed for reading and editing HTML but it works fine with XML files, since XML files are more tidy than HTML. Reading and traversing the XML is easy, just use the find function.</p>
<pre>$xml = file_get_html('http://www.google.com/');
foreach($xml-&gt;find('img') as $element)
       echo $element;</pre>
<p>Writing a new node is not difficult either.</p>
<pre>$node = <strong>str_get_html</strong>(<span class="var">'&lt;sample_node&gt;Hello World&lt;/sample&gt;'</span>);</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=E-wSJ1Z6hIg:3umf1TIc8rQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=E-wSJ1Z6hIg:3umf1TIc8rQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=E-wSJ1Z6hIg:3umf1TIc8rQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=E-wSJ1Z6hIg:3umf1TIc8rQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=E-wSJ1Z6hIg:3umf1TIc8rQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=E-wSJ1Z6hIg:3umf1TIc8rQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=E-wSJ1Z6hIg:3umf1TIc8rQ:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/E-wSJ1Z6hIg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/</feedburner:origLink></item>
		<item>
		<title>Just for fun, try this on Firefox or IE</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/cHR0icNQrN0/</link>
		<comments>http://shang-liang.com/blog/just-for-fun-try-this-on-firefox-or-ie/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 11:29:46 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=168</guid>
		<description><![CDATA[http://www.shang-liang.com/musicplayer/
Please be patient with my slow server. Thank you!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shang-liang.com/musicplayer/">http://www.shang-liang.com/musicplayer/</a></p>
<p>Please be patient with my slow server. Thank you!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=cHR0icNQrN0:NNoEBhbsn6o:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=cHR0icNQrN0:NNoEBhbsn6o:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=cHR0icNQrN0:NNoEBhbsn6o:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=cHR0icNQrN0:NNoEBhbsn6o:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=cHR0icNQrN0:NNoEBhbsn6o:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=cHR0icNQrN0:NNoEBhbsn6o:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=cHR0icNQrN0:NNoEBhbsn6o:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/cHR0icNQrN0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/just-for-fun-try-this-on-firefox-or-ie/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/just-for-fun-try-this-on-firefox-or-ie/</feedburner:origLink></item>
		<item>
		<title>Update: Configure FlashDevelop Code Autocompletion For AIR API</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/5ZiqXVQh5vE/</link>
		<comments>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 03:33:25 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=166</guid>
		<description><![CDATA[Previously in Flash CS3, the trick of getting autocompletion in FlashDevelop is not working any more in Flash CS4, ast least not in my case. After testing a while I finally got it working again by setting the swc path of the project.
Choose &#8220;Project&#62;&#62;Properties&#8230;&#62;&#62;Compiler Options&#62;&#62;SWC Include Libraries&#8221; and add the path of AIR swc to [...]]]></description>
			<content:encoded><![CDATA[<p>Previously in Flash CS3, <a href="http://shang-liang.com/blog/configure-flashdevelop-code-autocomplition-for-air-api/" target="_blank">the trick of getting autocompletion in FlashDevelop</a> is not working any more in Flash CS4, ast least not in my case. After testing a while I finally got it working again by setting the swc path of the project.</p>
<p>Choose &#8220;Project&gt;&gt;Properties&#8230;&gt;&gt;Compiler Options&gt;&gt;SWC Include Libraries&#8221; and add the path of AIR swc to it. Most likely it would be something like this: &#8220;C:\Program Files\Adobe\Adobe Flash CS4\AIK1.5\frameworks\libs\air\airglobal.swc&#8221;</p>
<p>Cheers!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=5ZiqXVQh5vE:yxJmed_4Bv4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=5ZiqXVQh5vE:yxJmed_4Bv4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=5ZiqXVQh5vE:yxJmed_4Bv4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=5ZiqXVQh5vE:yxJmed_4Bv4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=5ZiqXVQh5vE:yxJmed_4Bv4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=5ZiqXVQh5vE:yxJmed_4Bv4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=5ZiqXVQh5vE:yxJmed_4Bv4:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/5ZiqXVQh5vE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/</feedburner:origLink></item>
		<item>
		<title>SWFObject 2.2 and SWFAddress 2.3 Conflict - flashvars have problem in IE</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/NwTeHwj6bBY/</link>
		<comments>http://shang-liang.com/blog/swfobject-22-and-swfaddress-23-conflict-flashvars-have-problem-in-ie/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 05:47:23 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=162</guid>
		<description><![CDATA[The problem has been noted in SWFObject&#8217;s issue log. If you encounter any problem with flashvars not showing up in IE, downgrade SWFAdress to 2.2 will solve the problem. You can download other versions of SWFAdress from SourceForge.
]]></description>
			<content:encoded><![CDATA[<p>The problem has been noted in <a href="http://code.google.com/p/swfobject/issues/detail?id=338#c0">SWFObject&#8217;s issue log</a>. If you encounter any problem with flashvars not showing up in IE, downgrade SWFAdress to 2.2 will solve the problem. You can download other versions of SWFAdress from <a href="http://sourceforge.net/projects/swfaddress/files/">SourceForge</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=NwTeHwj6bBY:dx070xpmAu8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=NwTeHwj6bBY:dx070xpmAu8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=NwTeHwj6bBY:dx070xpmAu8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=NwTeHwj6bBY:dx070xpmAu8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=NwTeHwj6bBY:dx070xpmAu8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=NwTeHwj6bBY:dx070xpmAu8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=NwTeHwj6bBY:dx070xpmAu8:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/NwTeHwj6bBY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/swfobject-22-and-swfaddress-23-conflict-flashvars-have-problem-in-ie/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/swfobject-22-and-swfaddress-23-conflict-flashvars-have-problem-in-ie/</feedburner:origLink></item>
		<item>
		<title>Unhappy with Flash CS4</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/tQzq4FQW3XM/</link>
		<comments>http://shang-liang.com/blog/unhappy-with-flash-cs4/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 08:23:30 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=155</guid>
		<description><![CDATA[Why &#8220;z&#8221; is not the shortcut key for zoom any more? There&#8217;s no &#8220;z&#8221; in &#8220;Bind Tool&#8221; but why it&#8217;s configured this way? I thought Adobe is trying to standardize all shortcut keys across all its software?
Why the help page is online? After I managed to set the help offline, I realized they took out [...]]]></description>
			<content:encoded><![CDATA[<p>Why &#8220;z&#8221; is not the shortcut key for zoom any more? There&#8217;s no &#8220;z&#8221; in &#8220;Bind Tool&#8221; but why it&#8217;s configured this way? I thought Adobe is trying to standardize all shortcut keys across all its software?</p>
<p>Why the help page is online? After I managed to set the help offline, I realized they took out Actionscript 2 references. </p>
<p>Fuck you whoever made these decisions! </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tQzq4FQW3XM:ngKL4rrpARQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tQzq4FQW3XM:ngKL4rrpARQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tQzq4FQW3XM:ngKL4rrpARQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tQzq4FQW3XM:ngKL4rrpARQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tQzq4FQW3XM:ngKL4rrpARQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tQzq4FQW3XM:ngKL4rrpARQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tQzq4FQW3XM:ngKL4rrpARQ:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/tQzq4FQW3XM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/unhappy-with-flash-cs4/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/unhappy-with-flash-cs4/</feedburner:origLink></item>
		<item>
		<title>Algorithm for adding leading zeros</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/RPdMc3utddg/</link>
		<comments>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 06:42:10 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=143</guid>
		<description><![CDATA[I&#8217;ve always been writing this.

		function addZero(n:int):String {
			if (n < 10) {
				return "0" + n;
			}else {
				return "" + n;
			}
		}

The function adds one leading 0 quite well but if two 0 is needed, it&#8217;s quite bad to write all the conditions to check whether it&#8217;s less than 100 or 10. I think the following code is more [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been writing this.</p>
<pre>
		function addZero(n:int):String {
			if (n < 10) {
				return "0" + n;
			}else {
				return "" + n;
			}
		}
</pre>
<p>The function adds one leading 0 quite well but if two 0 is needed, it&#8217;s quite bad to write all the conditions to check whether it&#8217;s less than 100 or 10. I think the following code is more efficient. </p>
<pre>

		function addZero(n:int, numZeros:int = 1):String {
			var str:String = n + "";
			while (str.length&lt;numZeros+1)
			{
				str = "0" + str;
			}
			return str;
		}
</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=RPdMc3utddg:QQamcO5imDM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=RPdMc3utddg:QQamcO5imDM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=RPdMc3utddg:QQamcO5imDM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=RPdMc3utddg:QQamcO5imDM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=RPdMc3utddg:QQamcO5imDM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=RPdMc3utddg:QQamcO5imDM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=RPdMc3utddg:QQamcO5imDM:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/RPdMc3utddg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/</feedburner:origLink></item>
		<item>
		<title>A new trick to make pixel fonts clear in Flash</title>
		<link>http://feedproxy.google.com/~r/shang-liang/feed/~3/tt0pphCpl8k/</link>
		<comments>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 05:14:20 +0000</pubDate>
		<dc:creator>5566</dc:creator>
		
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/</guid>
		<description><![CDATA[Pixel fonts tend to get blur in Flash. Most of the time the problem can be solved by setting the textfield&#8217;s coordinates (x,y) into integers but sometimes it fails to work. I&#8217;ve found a new trick to solve this problem. If you check the option of the textfield to be selectable, the texts appear clear [...]]]></description>
			<content:encoded><![CDATA[<p>Pixel fonts tend to get blur in Flash. Most of the time the problem can be solved by setting the textfield&#8217;s coordinates (x,y) into integers but sometimes it fails to work. I&#8217;ve found a new trick to solve this problem. If you check the option of the textfield to be selectable, the texts appear clear no matter what their x and y are.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tt0pphCpl8k:FxN9mY_FAOU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tt0pphCpl8k:FxN9mY_FAOU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tt0pphCpl8k:FxN9mY_FAOU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tt0pphCpl8k:FxN9mY_FAOU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tt0pphCpl8k:FxN9mY_FAOU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/shang-liang/feed?a=tt0pphCpl8k:FxN9mY_FAOU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/shang-liang/feed?i=tt0pphCpl8k:FxN9mY_FAOU:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/shang-liang/feed/~4/tt0pphCpl8k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/feed/</wfw:commentRss>
		<feedburner:origLink>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/</feedburner:origLink></item>
	</channel>
</rss>
