<?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>nightdrops.com &#187; actionscript</title>
	<atom:link href="http://www.nightdrops.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nightdrops.com</link>
	<description>like the color blue</description>
	<lastBuildDate>Thu, 01 Jul 2010 13:19:03 +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>About Flash Optimization</title>
		<link>http://www.nightdrops.com/2010/about-flash-optimization/</link>
		<comments>http://www.nightdrops.com/2010/about-flash-optimization/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 13:14:30 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[resources]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=396</guid>
		<description><![CDATA[Working with flash and actionscript I often stumble upon bad and slow code (either old code of mine or written by others &#8211; designers); In this post I&#8217;ll try to list some resources worth knowing if you want to write fast and nice code. Best Practices Do not use Objects, if you know which properties [...]]]></description>
			<content:encoded><![CDATA[<p>Working with flash and actionscript I often stumble upon bad and slow code (either old code of mine or written by others &#8211; designers); In this post I&#8217;ll try to list some resources worth knowing if you want to write fast and nice code.</p>
<h2>Best Practices</h2>
<ol>
<li>Do not use Objects, if you know which properties will be finally involved: dynamic properties are slow to read. Create custom classes instead.</li>
<li>Strong type everything. If you think there is a reason to avoid strong typing, at least use <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/specialTypes.html#*" target="_blank">*</a> as type.</li>
<li>Try out and test different strategies with <a href="http://www.gskinner.com/blog/archives/2009/04/as3_performance.html" target="_blank">Grant Skinner&#8217;s performance framework</a>.</li>
</ol>
<h2>Resources</h2>
<ul>
<li><a href="http://gskinner.com/talks/quick/" target="_blank">Quick as a Flash</a> &#8211; by Grant Skinner. The bible.</li>
<li><a href="http://vimeo.com/12974053" target="_blank">Best Practices in optimizing content for Flash Player 10.1</a> by Thibault Imbert (The Product Manager of the Flash Player). It&#8217;s about optimizing for Flash Player 10.1 on mobile devices, worth knowing also for the desktop / browser developers.</li>
<li><a href="http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/" target="_blank">Some ActionScript 3.0 Optimizations</a></li>
</ul>
<p>Feel free to suggest more :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2010/about-flash-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickreference: flipping DisplayObjects</title>
		<link>http://www.nightdrops.com/2010/quickreference-flipping-displayobjects/</link>
		<comments>http://www.nightdrops.com/2010/quickreference-flipping-displayobjects/#comments</comments>
		<pubDate>Wed, 19 May 2010 10:00:04 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[quickreference]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=387</guid>
		<description><![CDATA[This one flips DisplayObjects on a vertical or horizontal axe. public static function flipHorizontal(obj:DisplayObject):void { &#160; &#160; var m:Matrix = obj.transform.matrix; &#160; &#160; m.transformPoint(new Point(obj.width * .5, obj.height * .5)); &#160; &#160; m.tx = (m.a &#62; 0)?obj.width + obj.x:obj.x - obj.width;&#160; &#160; &#160; &#160; &#160; &#160; &#160; m.a = -1 * m.a; &#160; &#160; obj.transform.matrix [...]]]></description>
			<content:encoded><![CDATA[<p>This one flips DisplayObjects on a vertical or horizontal axe.<br />
</p><p></p><div class='code' style='overflow: auto; white-space:nowrap;'>public static function flipHorizontal(obj:DisplayObject):void {<br />
&nbsp; &nbsp; var m:Matrix = obj.transform.matrix;<br />
&nbsp; &nbsp; m.transformPoint(new Point(obj.width * .5, obj.height * .5));<br />
&nbsp; &nbsp; m.tx = (m.a &gt; 0)?obj.width + obj.x:obj.x - obj.width;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; m.a = -1 * m.a;<br />
&nbsp; &nbsp; obj.transform.matrix = m;<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
public static function flipVertical(obj:DisplayObject):void {<br />
&nbsp; &nbsp; var m:Matrix = obj.transform.matrix;<br />
&nbsp; &nbsp; m.transformPoint(new Point(obj.width * .5, obj.height * .5));<br />
&nbsp; &nbsp; m.ty = (m.d &gt; 0)?obj.y + obj.height:obj.y - obj.height;<br />
&nbsp; &nbsp; m.d = -1 * m.d;<br />
&nbsp; &nbsp; obj.transform.matrix = m;<br />
}</div><p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2010/quickreference-flipping-displayobjects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sealed and dynamic  classes</title>
		<link>http://www.nightdrops.com/2009/sealed-and-dynamic-classes/</link>
		<comments>http://www.nightdrops.com/2009/sealed-and-dynamic-classes/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 11:07:48 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=284</guid>
		<description><![CDATA[Back in the days of actionscript 2, you could add any property to pretty much any object, just calling it and setting a value, like this: &#160;myMovieClip.thePropertyILikeWithAStrangeName = &#34;some string&#34; Actionscript 3.0 instead, being a more serious language, defines the basic class as sealed. That means that you can&#8217;t add any property on a object. [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the days of actionscript 2, you could add any property to pretty much any object, just calling it and setting a value, like this:</p>
<p><code class="codecolorer actionscript default"><span class="actionscript">&nbsp;myMovieClip.<span style="color: #006600;">thePropertyILikeWithAStrangeName</span> = <span style="color: #ff0000;">&quot;some string&quot;</span></span></code></p>
<p>Actionscript 3.0 instead, being a more serious language, defines the basic class as sealed. That means that you can&#8217;t add any property on a object. You have to extends that class, and adding public properties.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyClass <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">public</span> thePropertyILikeWithAStrangeName:<span style="color: #0066CC;">String</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>That class is sealed. You can&#8217;t</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> foo:MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
foo.<span style="color: #006600;">anotherProperty</span> = <span style="color: #cc66cc;">42</span>;</div></div>
<p>The <code class="codecolorer actionscript default"><span class="actionscript"><span style="color: #0066CC;">dynamic</span></span></code> keyword, permits to &#8216;unseal&#8217; a class, giving back the possibility to add any property on runtime.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">dynamic</span> <span style="color: #000000; font-weight: bold;">class</span> MyClass <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">public</span> thePropertyILikeWithAStrangeName:<span style="color: #0066CC;">String</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Now you can:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> foo:MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
foo.<span style="color: #006600;">anotherProperty</span> = <span style="color: #cc66cc;">42</span>;</div></div>
<p>There are speed and cleaness drawbacks on using dynamic classes. The rule is that if you use it, you should be able to seriously motivate it.</p>
<p>Note that there are few dynamic classes in the default Actionscript framework; the most known is of course, <code class="codecolorer actionscript default"><span class="actionscript"><span style="color: #0066CC;">Object</span></span></code> .</p>
<p>Read more:<br />
<a href="http://livedocs.adobe.com/flash/9.0_it/ActionScriptLangRefV3/statements.html#dynamic" target="_blank">livedocs</a><br />
<a href="http://flexmusings.wordpress.com/2008/06/23/actionscript-3-dynamic-classes/" target="_blank">ActionScript 3: Dynamic Classes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/sealed-and-dynamic-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic random functions</title>
		<link>http://www.nightdrops.com/2009/basic-random-functions/</link>
		<comments>http://www.nightdrops.com/2009/basic-random-functions/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 13:53:26 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[quickreference]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=270</guid>
		<description><![CDATA[Here are some really basic (but useful) functions that returns random stuff&#8230; The really basic one, is built in the Flash api and it returns a Number between 0 and 1: var n:Number = Math.random&#40;&#41;; A number in  a range Sometime is more useful to have a random number in a different range, let&#8217;s say [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some really basic (but useful) functions that returns random stuff&#8230;</p>
<p>The really basic one, is built in the Flash api and it returns a <code class="codecolorer actionscript default"><span class="actionscript"><span style="color: #0066CC;">Number</span></span></code> between 0 and 1:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<h4>A number in  a range</h4>
<p>Sometime is more useful to have a random number in a different range, let&#8217;s say between 15 and 45, instead of 0 and 1.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> randNumber<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">min</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span> - <span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">min</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<h4>Random int</h4>
<p>and what if we don&#8217;t need decimals? Round&#8217;em!</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> randInt<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">min</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span> - <span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<h4>Random boolean</h4>
<p>True or false? Flip a coin.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> bool<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<h4>Random sign</h4>
<p>-1 or 1; Useful when you have to random select random rotation verse, for example, -1*45 or 1*45, rotates counterclockwise or clockwise.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> sign<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:-<span style="color: #cc66cc;">1</span>:<span style="color: #cc66cc;">1</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<h4>Random color</h4>
<p>Really useful when drawing debug shapes on screen..</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">color</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:uint <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> 0xFFFFFF;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<h4>Random point</h4>
<p>Inside an area. I like to use the flash.geom.Rectangle struct to describe an area, more than using 4 parameters (Flash api are quite inconsistent about this choice)</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> point<span style="color: #66cc66;">&#40;</span>area:Rectangle<span style="color: #66cc66;">&#41;</span>:Point <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>randInt<span style="color: #66cc66;">&#40;</span>area.<span style="color: #006600;">x</span>, area.<span style="color: #006600;">x</span> + area.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>, randInt<span style="color: #66cc66;">&#40;</span>area.<span style="color: #006600;">y</span>, area.<span style="color: #006600;">y</span> + area.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/basic-random-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickreference: display elements in a circle</title>
		<link>http://www.nightdrops.com/2009/quickreference-display-elements-in-a-circle/</link>
		<comments>http://www.nightdrops.com/2009/quickreference-display-elements-in-a-circle/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 13:00:54 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[quickreference]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=227</guid>
		<description><![CDATA[How to display elements in a circle? A small function to do that is: GeSHi Error: GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2) Parameters are: items: the items to be displayed a a circle center: the center of the circle distance: the distance from the center initialAngle: the angle of [...]]]></description>
			<content:encoded><![CDATA[<p>How to display elements in a circle? A small function to do that is:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
<p>Parameters are:</p>
<ul>
<li>items: the items to be displayed a a circle</li>
<li>center: the center of the circle</li>
<li>distance: the distance from the center</li>
<li>initialAngle: the angle of the first item. Zero means that the item wil be aligned orizontally with the center, on his right.</li>
</ul>
<p>Here&#8217;s an example:</p>
<p><object style="width: 400px; height: 300px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="/wp-content/uploads/2009/07/CircleSortingExample.swf" /><embed style="width: 400px; height: 300px;" type="application/x-shockwave-flash" width="400" height="300" src="/wp-content/uploads/2009/07/CircleSortingExample.swf"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/quickreference-display-elements-in-a-circle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Graph examples</title>
		<link>http://www.nightdrops.com/2009/graph-examples/</link>
		<comments>http://www.nightdrops.com/2009/graph-examples/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 16:30:45 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[asframework]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[just for fun]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=222</guid>
		<description><![CDATA[I&#8217;ve always been fascinated by networks, and everything that can be modeled as a graph. In some spare time one I&#8217;ve tried to model a simple graph structure in actionscript 3 that can be implemented to render some nice example. I want to extend it by adding some graph algorhythm like Breadth-first search, Depth-first seach, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been fascinated by networks, and everything that can be modeled as a graph. In some spare time one I&#8217;ve tried to model a simple graph structure in actionscript 3 that can be implemented to render some nice example. I want to extend it by adding some graph algorhythm like <a href="http://en.wikipedia.org/wiki/Breadth-first_search" target="_blank">Breadth-first search</a>, <a href="http://en.wikipedia.org/wiki/Depth-first_search">Depth-first seach</a>, <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra</a> and others, just to keep mind busy in the summer, since in 3 days from now i&#8217;ll be officially unemployed.</p>
<p>So the first example consists in a bunch of nodes connected.. uhhu! Nodes can be activated, and each time this happens to a node, there is a chance that he activates his neighbours.</p>
<p><object style="width: 400px; height: 300px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="/wp-content/uploads/2009/07/example.swf" /><embed style="width: 400px; height: 300px;" type="application/x-shockwave-flash" width="400" height="300" src="/wp-content/uploads/2009/07/example.swf" wmode="transparent"></embed></object></p>
<p>If you want to see the code, there are two steps: I&#8217;ve stored the code that models the network (the Graph class and the INode interface) in a simple framework of mine that you can checkout from <a href="http://code.google.com/p/asframework/source/checkout" target="_blank">here</a>; then you can download the project as a zip file from <a href="http://www.nightdrops.com/wp-content/uploads/2009/07/Network1.zip">this link</a>)</p>
<p>As a references, you should see Levitated examples on networks, starting by <a href="http://www.levitated.net/daily/levBinaryNetworkv1.html">this one</a> or  <a href="http://www.levitated.net/daily/levBinaryNetworkv6.html">by this one</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/graph-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweening global volume in flash</title>
		<link>http://www.nightdrops.com/2009/tweening-global-volume-in-flash/</link>
		<comments>http://www.nightdrops.com/2009/tweening-global-volume-in-flash/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 14:22:12 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[quickreference]]></category>
		<category><![CDATA[TweenLite]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=217</guid>
		<description><![CDATA[Just a quick reminder on how to shut up the master volume on a flash project. I like a smooth tween to the silence, so I&#8217;m using the TweenLite libraries. GeSHi Error: GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2) The trick here is to tween the volume property of a [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick reminder on how to shut up the master volume on a flash project. I like a smooth tween to the silence, so I&#8217;m using the TweenLite libraries.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
<p>The trick here is to tween the volume property of a throw-away SoundTransform object, and on each step of the Tween apply that object as the SoundMixer.soundTransform Object, with an helper function. Note that I&#8217;m not going to write the function inside the TweenLite&#8217;s partameter list, as it is gross and dirty.</p>
<p>Tweening the volume back to 1 is so easy that I&#8217;m not writing it, to not offend anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/tweening-global-volume-in-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving preferences in Air Applications</title>
		<link>http://www.nightdrops.com/2009/saving-preferences-in-air-applications/</link>
		<comments>http://www.nightdrops.com/2009/saving-preferences-in-air-applications/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 09:43:20 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=185</guid>
		<description><![CDATA[Every now and then, while working on a AIR application, i feel the need to save or restore some config info, like the last window position, or the last opened files. Instead of embedding this login in every app, I thought about a PreferenceManager class that stores and restores values. How it should behave: It [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then, while working on a AIR application, i feel the need to save or restore some config info, like the last window position, or the last opened files.</p>
<p>Instead of embedding this login in every app, I thought about a PreferenceManager class that stores and restores values.</p>
<p>How it should behave:</p>
<ul>
<li>It must save data on a file.</li>
<li>It must save data on an open and editable format, so if something goes wrong..</li>
<li>It should be a static class, so i can access it in every other class of my application, whitout the need to have the reference to the instantiated object.</li>
<li>It should be really simple to use. And should not require any setup.</li>
</ul>
<p><span id="more-185"></span><br />
So having stated this, the public interface looks like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
<p>Preferences will be saved in a file in File.applicationStorageDirectory called preferences.xml, so every Application will have his own preference file.</p>
<p>The usage comes easy, when I want to save a preference, let&#8217;s say the last user name entered I&#8217;ll</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
<p>and next time I open the application, to retrieve the data</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
<p>This implies two things: when i get a preference that hasn&#8217;t been set, the method will return null and I can only save string values.</p>
<p>Sooner or later I&#8217;ll talk about reflection and how to serialize any kind of object.</p>
<p><a href="http://www.nightdrops.com/wp-content/uploads/2009/04/preferences.zip">So now go download the Preferences.as class!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/saving-preferences-in-air-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick reference: Drawing a scaled object in Actionscript</title>
		<link>http://www.nightdrops.com/2009/quick-reference-drawing-a-scaled-object-in-actionscript/</link>
		<comments>http://www.nightdrops.com/2009/quick-reference-drawing-a-scaled-object-in-actionscript/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 09:43:52 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[quickreference]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=167</guid>
		<description><![CDATA[Just as a quick reference, since I usually forgot each time how to do it. Assume to have a DisplayObject obj, you want to draw in a Bitmap a scaled snapshot of that object. Just like when you are drawing thumbs. GeSHi Error: GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)]]></description>
			<content:encoded><![CDATA[<p>Just as a quick reference, since I usually forgot each time how to do it.</p>
<p>Assume to have a DisplayObject obj, you want to draw in a Bitmap a scaled snapshot of that object.</p>
<p>Just like when you are drawing thumbs.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><br /><strong>GeSHi Error:</strong> GeSHi could not find the language actionscript3 (using path /nfs/c03/h01/mnt/85630/domains/nightdrops.com/html/wp-content/plugins/snipplr/geshi/geshi/) (code 2)<br /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/quick-reference-drawing-a-scaled-object-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash &amp; Math</title>
		<link>http://www.nightdrops.com/2009/flash-math/</link>
		<comments>http://www.nightdrops.com/2009/flash-math/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 21:56:59 +0000</pubDate>
		<dc:creator>kajyr</dc:creator>
				<category><![CDATA[Blog posts]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://www.nightdrops.com/?p=154</guid>
		<description><![CDATA[Since my particular relationship with math during all of my studies, one site about ActionScript programming I really do like following is FlashAndMath. There are a lot of good tutorial about non trivial problems, so fire up your (Google)  Reader and start tracking this site. I usually talk about problems and tricks i see during [...]]]></description>
			<content:encoded><![CDATA[<p>Since my particular relationship with math during all of my studies, one site about ActionScript programming I really do like following is <a href="http://www.flashandmath.com/" target="_blank">FlashAndMath</a>. There are a lot of good tutorial about non trivial problems, so fire up your (Google)  Reader and start tracking this site.</p>
<p>I usually talk about problems and tricks i see during work hours, but I really should evolve and talk a little more about maths here. :-)</p>
<p><a href="http://www.flashandmath.com/" target="_blank">www.flashandmath.com</a></p>
<p>On a side note, if anyone has suggestions about things i may talk about, just drop a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightdrops.com/2009/flash-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
