<?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>Ajar Productions &#187; Tutorials</title>
	<atom:link href="http://ajarproductions.com/blog/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://ajarproductions.com/blog</link>
	<description>Animation &#124; Design &#124; Development</description>
	<lastBuildDate>Mon, 28 Jun 2010 02:06:43 +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>MotionBrush: Free Actionscript Class</title>
		<link>http://ajarproductions.com/blog/2009/05/02/motionbrush/</link>
		<comments>http://ajarproductions.com/blog/2009/05/02/motionbrush/#comments</comments>
		<pubDate>Sat, 02 May 2009 00:43:11 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/?p=476</guid>
		<description><![CDATA[One idea that I had when creating the MotionSketch extension was that it could be used to do write-on effects. I was going to write an Actionscript class to demo this effect prior to releasing MotionSketch but ran out of time. So I tweaked a version of vCam to quickly demo the effect for the [...]]]></description>
			<content:encoded><![CDATA[<p>One idea that I had when creating the <a href="http://ajarproductions.com/blog/2009/02/10/flash-extension-motionsketch/" target="_blank">MotionSketch</a> extension was that it could be used to do write-on effects. I was going to write an Actionscript class to demo this effect prior to releasing MotionSketch but ran out of time. So I tweaked a version of <a href="http://bryanheisey.com/blog/?p=1" target="_blank">vCam</a> to quickly demo the effect for the MotionSketch video tutorial. Thanks to a reader&#8217;s email, I was reminded that I still had yet to write this class. It&#8217;s now written and free to download. I&#8217;m calling it <em>MotionBrush</em> to keep it in the family with MotionSketch and <a href="http://ajarproductions.com/blog/2009/03/02/new-flash-extension-motionblur/" target="_blank">MotionBlur</a>. It&#8217;s super simple to use. Check out the video tutorial:</p>
<p><object width="581" height="327" data="http://vimeo.com/moogaloop.swf?clip_id=4436636&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=cccccc&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4436636&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=cccccc&amp;fullscreen=1" /></object></p>
<p><strong><br />
Download<br />
</strong><a href="http://ajarproductions.com/projects/actionscript/MotionBrush.zip">MotionBrush.zip</a></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class&amp;bodytext=One%20idea%20that%20I%20had%20when%20creating%20the%20MotionSketch%20extension%20was%20that%20it%20could%20be%20used%20to%20do%20write-on%20effects.%20I%20was%20going%20to%20write%20an%20Actionscript%20class%20to%20demo%20this%20effect%20prior%20to%20releasing%20MotionSketch%20but%20ran%20out%20of%20time.%20So%20I%20tweaked%20a%20version%20" title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class&amp;notes=One%20idea%20that%20I%20had%20when%20creating%20the%20MotionSketch%20extension%20was%20that%20it%20could%20be%20used%20to%20do%20write-on%20effects.%20I%20was%20going%20to%20write%20an%20Actionscript%20class%20to%20demo%20this%20effect%20prior%20to%20releasing%20MotionSketch%20but%20ran%20out%20of%20time.%20So%20I%20tweaked%20a%20version%20" title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=MotionBrush%3A%20Free%20Actionscript%20Class&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;t=MotionBrush%3A%20Free%20Actionscript%20Class" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class&amp;annotation=One%20idea%20that%20I%20had%20when%20creating%20the%20MotionSketch%20extension%20was%20that%20it%20could%20be%20used%20to%20do%20write-on%20effects.%20I%20was%20going%20to%20write%20an%20Actionscript%20class%20to%20demo%20this%20effect%20prior%20to%20releasing%20MotionSketch%20but%20ran%20out%20of%20time.%20So%20I%20tweaked%20a%20version%20" title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=One%20idea%20that%20I%20had%20when%20creating%20the%20MotionSketch%20extension%20was%20that%20it%20could%20be%20used%20to%20do%20write-on%20effects.%20I%20was%20going%20to%20write%20an%20Actionscript%20class%20to%20demo%20this%20effect%20prior%20to%20releasing%20MotionSketch%20but%20ran%20out%20of%20time.%20So%20I%20tweaked%20a%20version%20" title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;title=MotionBrush%3A%20Free%20Actionscript%20Class" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F&amp;t=MotionBrush%3A%20Free%20Actionscript%20Class" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=MotionBrush%3A%20Free%20Actionscript%20Class&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=MotionBrush%3A%20Free%20Actionscript%20Class%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F05%2F02%2Fmotionbrush%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2009/05/02/motionbrush/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Reduce Flash File Size by Drawing with Actionscript</title>
		<link>http://ajarproductions.com/blog/2009/03/29/reduce-flash-filesize-by-drawing-with-actionscript/</link>
		<comments>http://ajarproductions.com/blog/2009/03/29/reduce-flash-filesize-by-drawing-with-actionscript/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 01:23:21 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[size]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/?p=447</guid>
		<description><![CDATA[Thanks to a generous donation, I've picked up a much nicer video capture application. This video tutorial shows how to translate Photoshop graphics into Actionscript using the AS3 drawing API. The resulting SWF file size is minuscule: from a 100kb Photoshop-to-Flash import to a 5kb file with some coding. I start with the most basic aspects and work up to the more complex: from a basic rectangle, to patterns from Photoshop, to complex gradients.]]></description>
			<content:encoded><![CDATA[<p>Thanks to a generous donation, I&#8217;ve picked up a much nicer <a href="http://www.shinywhitebox.com/home/home.html" target="_blank">video capture application</a>. This video tutorial shows how to translate Photoshop graphics into Actionscript using the AS3 drawing API. The resulting SWF file size is minuscule: from a 100kb Photoshop-to-Flash import to a 5kb file with some coding. I start with the most basic aspects and work up to the more complex: from a basic rectangle, to patterns from Photoshop, to complex gradients.</p>
<p>I&#8217;m pretty happy with this new software, so I&#8217;ll try to post more videos. Still working on getting better resolution out of the video host though&#8230;</p>
<p><object width="581" height="363" data="http://vimeo.com/moogaloop.swf?clip_id=3899521&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=cccccc&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=3899521&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=cccccc&amp;fullscreen=1" /></object></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;bodytext=Thanks%20to%20a%20generous%20donation%2C%20I%27ve%20picked%20up%20a%20much%20nicer%20video%20capture%20application.%20This%20video%20tutorial%20shows%20how%20to%20translate%20Photoshop%20graphics%20into%20Actionscript%20using%20the%20AS3%20drawing%20API.%20The%20resulting%20SWF%20file%20size%20is%20minuscule%3A%20from%20a%20100kb%20Photoshop-to-Flash%20import%20to%20a%205kb%20file%20with%20some%20coding.%20I%20start%20with%20the%20most%20basic%20aspects%20and%20work%20up%20to%20the%20more%20complex%3A%20from%20a%20basic%20rectangle%2C%20to%20patterns%20from%20Photoshop%2C%20to%20complex%20gradients." title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;notes=Thanks%20to%20a%20generous%20donation%2C%20I%27ve%20picked%20up%20a%20much%20nicer%20video%20capture%20application.%20This%20video%20tutorial%20shows%20how%20to%20translate%20Photoshop%20graphics%20into%20Actionscript%20using%20the%20AS3%20drawing%20API.%20The%20resulting%20SWF%20file%20size%20is%20minuscule%3A%20from%20a%20100kb%20Photoshop-to-Flash%20import%20to%20a%205kb%20file%20with%20some%20coding.%20I%20start%20with%20the%20most%20basic%20aspects%20and%20work%20up%20to%20the%20more%20complex%3A%20from%20a%20basic%20rectangle%2C%20to%20patterns%20from%20Photoshop%2C%20to%20complex%20gradients." title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;t=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;annotation=Thanks%20to%20a%20generous%20donation%2C%20I%27ve%20picked%20up%20a%20much%20nicer%20video%20capture%20application.%20This%20video%20tutorial%20shows%20how%20to%20translate%20Photoshop%20graphics%20into%20Actionscript%20using%20the%20AS3%20drawing%20API.%20The%20resulting%20SWF%20file%20size%20is%20minuscule%3A%20from%20a%20100kb%20Photoshop-to-Flash%20import%20to%20a%205kb%20file%20with%20some%20coding.%20I%20start%20with%20the%20most%20basic%20aspects%20and%20work%20up%20to%20the%20more%20complex%3A%20from%20a%20basic%20rectangle%2C%20to%20patterns%20from%20Photoshop%2C%20to%20complex%20gradients." title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=Thanks%20to%20a%20generous%20donation%2C%20I%27ve%20picked%20up%20a%20much%20nicer%20video%20capture%20application.%20This%20video%20tutorial%20shows%20how%20to%20translate%20Photoshop%20graphics%20into%20Actionscript%20using%20the%20AS3%20drawing%20API.%20The%20resulting%20SWF%20file%20size%20is%20minuscule%3A%20from%20a%20100kb%20Photoshop-to-Flash%20import%20to%20a%205kb%20file%20with%20some%20coding.%20I%20start%20with%20the%20most%20basic%20aspects%20and%20work%20up%20to%20the%20more%20complex%3A%20from%20a%20basic%20rectangle%2C%20to%20patterns%20from%20Photoshop%2C%20to%20complex%20gradients." title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;title=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F&amp;t=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Reduce%20Flash%20File%20Size%20by%20Drawing%20with%20Actionscript%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F29%2Freduce-flash-filesize-by-drawing-with-actionscript%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2009/03/29/reduce-flash-filesize-by-drawing-with-actionscript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hacking the Flash CS4 Motion Model to Create New Extensions</title>
		<link>http://ajarproductions.com/blog/2009/03/04/hacking-the-flash-cs4-motion-model-to-create-extensions/</link>
		<comments>http://ajarproductions.com/blog/2009/03/04/hacking-the-flash-cs4-motion-model-to-create-extensions/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 02:03:43 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ExtendScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jsfl]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[cs4]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[motion]]></category>
		<category><![CDATA[tween]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/?p=337</guid>
		<description><![CDATA[This JSFL technique can be used in Flash CS4 in lieu of the non-existent timeline.createMotionObjectTween() command. I refer to this as a "hack" because it's an unsupported method, but given the complexity of what can be created with this new motion model, editing the XML is actually a fairly efficient way to go about creating/editing a tween. I used this technique to create the EaseCaddy, MotionSketch, and MotionBlur extensions.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quote from an email I sent to <a href="http://keyframer.com/" target="_blank">Chris Georgenes</a> and <a href="http://quip.net" target="_blank">David Stiller</a> on 9/29/08 about an extension idea that I had using the new motion tweens in Flash CS4 (before I&#8217;d even used the application):</p>
<blockquote><p>Given that the new motion tween creates a bezier path, I&#8217;m guessing that we&#8217;ll have access to creating such a path with JSFL. Which led me to think about creating that path in real-time, similar to the real-time drawing that I&#8217;d seen from <a href="http://www.keyframer.com/index.php/2007/07/05/scribblebot/" target="_blank">ScribbleBot</a> on Chris&#8217;s blog. Instead of scribbling a line in real-time, I&#8217;d be sketching a motion path. There would be a variable to determine &#8220;smoothness&#8221; so that it doesn&#8217;t create an unmananageable amount of new motion keyframes. And it could probably be done with a custom tool rather than a panel, so that the sketching could be done directly on the stage.</p>
<p>That also leads me to wonder if there&#8217;s a way to record the armature animation in real-time and convert it to a motion tween, similar to the feature that already exists in After Effects CS3.</p></blockquote>
<p>I know, I&#8217;m a nerd. The first idea there became <a href="http://ajarproductions.com/blog/2009/02/10/flash-extension-motionsketch/">MotionSketch</a>. I haven&#8217;t yet found a way to accomplish the second idea with the armature, but I have a few ideas.</p>
<p>Prior to the release of Flash CS4, I had gotten a little hooked on creating Flash extensions. It&#8217;s quite easy to create a classic motion tween with JSFL (Flash Javascript), you can simply make the following call: <em>timeline.createMotionTween()</em>. It was likely that <em>createMotionTween() </em>would remain for legacy support even though the name of the tween had changed from &#8220;motion&#8221; to &#8220;classic.&#8221; I&#8217;d seen all of the great <a href="http://flashthusiast.com/2008/09/22/the-new-way-of-tweening-in-flash-cs4-or-new-motion-in-flash-cs4-makes-your-animations-better-faster-stronger/" target="_blank">new motion features</a> demonstrated online, and I expected there might be an equivalent call for a new motion tween.  When Lee Brimelow <a href="http://theflashblog.com/?p=448" target="_blank">linked to the CS4 documentation</a>, I went right to the <a href="http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/index.html" target="_blank">Extending Flash</a> section to see what had been added. I didn&#8217;t see any additions for the motion features, but I had also previously seen <a href="http://theflashblog.com/?p=445" target="_blank">Lee&#8217;s post</a> on <a href="http://www.flashcamp.org/" target="_blank">Flash Camp</a> in San Francisco. Fortunately, I live close to San Francisco and I decided to head over try out the application early, and maybe get a chance to talk with some of the Flash team about any undocumented features.</p>
<p>While at Flash Camp, I spoke with <a href="http://blogs.adobe.com/rgalvan/" target="_blank">Richard Galvan</a> and he directed me to John Mayhew, the engineer behind the new motion model in Flash. John was very affable and willing to follow up with me, but he didn&#8217;t know of any undocumented features offhand. Unfortunately, adding features to the JSFL API is usually somewhat of an afterthought because so much of the development time is spent on the new features themselves. I had a few ideas to use the new 3D features while at Flash Camp as well, but they were similarly left out of the JSFL API.</p>
<p>So I let those ideas go for awhile and focused on a <a href="http://ajarproductions.com/blog/2008/10/12/flash-extension-combine-textfields/">different extension</a> as my Flash Camp project. A few weeks later, I got a little antsy and I starting digging around in the Flash configuration directory for clues. I noticed two files in the Javascript directory named <em>MotionXML.jsfl</em> and <em>MotionClipboard.xml</em>. I started looking around in the JSFL file for undocumented commands that I could use, but to little avail. I think I even put some trace calls into the JSFL to spit out info when copying motion from the Flash IDE. I noticed that even though copying and pasting a new motion tween appeared to work the same way in the Flash interface as copying and pasting a classic tween, a new motion tween was not triggering the calls in the JSFL file. Looking at the XML file, I found that even though copying a motion tween wasn&#8217;t using the same JSFL calls, it was saving XML to the same file&#8230;just different XML. The classic tweens were generating XML with a root tag of <em>&lt;Motion&gt;</em> and the new tweens were generating a root tag of <em>&lt;AnimationCore&gt;</em>.</p>
<p>Flash seemed to be able to discern which type of motion it was copying or pasting and acting accordingly. So it occurred to me that I could grab the data from the motion clipboard and alter it before pasting it back. Additionally, if I wanted data from an existing tween, I could run a Copy Motion command, available to JSFL as of Flash CS3 thanks to Robert Penner&#8217;s <a href="http://robertpenner.com/flashblog/2007/08/links-for-copy-motion-as-actionscript-3_10.html" target="_blank">Copy Motion feature</a>, then go about altering and pasting. These are the extensions that I&#8217;ve created thus far using that very technique:</p>
<ul>
<li><a href="http://ajarproductions.com/blog/2009/02/26/the-missing-flash-panel-easecaddy/">EaseCaddy</a></li>
<li><a href="http://ajarproductions.com/blog/2009/02/10/flash-extension-motionsketch/">MotionSketch</a></li>
<li><a href="http://ajarproductions.com/blog/2009/03/02/new-flash-extension-motionblur/">MotionBlur</a></li>
</ul>
<p>Below is a rundown of the steps I used in the extensions mentioned above. This technique can be used in lieu of the non-existent <em>timeline.createMotionObjectTween()</em> command. I refer to this as a &#8220;<a href="http://en.wikipedia.org/wiki/Hack_(technology)" target="_blank">hack</a>&#8221; because it&#8217;s an unsupported method, but given the complexity of what can be created with this new motion model, editing the XML is actually a fairly efficient way to go about creating/editing a tween. If the XML is not properly formed, it can cause Flash to crash when you try to paste the motion, or it can create some funky bugs in the Motion Editor. Be sure to test your code thoroughly before releasing anything for public consumption.  The language is <a href="http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/WS5b3ccc516d4fbf351e63e3d118a9024f3f-7fe8.html" target="_blank">JSFL</a> (used to automate and manipulate the Flash authoring environment). There&#8217;s a link to documentation for the AnimationCore XML listed in step 3.</p>
<p><span id="more-337"></span></p>
<p><strong>Step 1:</strong> Store the motion clipboard so you can restore it when you&#8217;re done. In some cases, I store it as a file. In this example, I store it as a variable.</p>
<p><code>var MOTION_CLIPBOARD = fl.configURI + "Javascript/MotionClipboard.xml";<br />
var tl = fl.getDocumentDOM().getTimeline();<br />
var storedMotion = FLfile.read(MOTION_CLIPBOARD);</code></p>
<p><strong>Step 2(a):</strong> Copy motion to clipboard, retrieve the new clipboard contents and convert to XML. Use this step if you want alter an existing motion tween. The <a href="http://ajarproductions.com/blog/2009/02/28/new-flash-extension-motionblur/">MotionBlur</a> extension uses this step.</p>
<p><code>tl.copyMotion();<br />
var xmlstr = FLfile.read(MOTION_CLIPBOARD);<br />
var motionXML = new XML(xmlstr)</code></p>
<p><strong>Step 2(b)</strong>: Instead of copying the motion, you can create a new tween by loading a more or less blank motion XML template and adding content to it. The <a href="http://ajarproductions.com/blog/2009/02/10/flash-extension-motionsketch/">MotionSketch</a> extension uses this step.<a href="http://ajarproductions.com/blog/2009/02/10/flash-extension-motionsketch/"><br />
</a></p>
<p><strong>Step 3:</strong> The motion XML can then be altered using <a href="http://robertpenner.com/flashblog/2007/08/jsfl-updated-to-javascript-16-gains-e4x.html">E4X</a>. This portion of the code is different for each extension, depending on what the extension is trying to accomplish. Here&#8217;s the <a href="http://flashthusiast.com/2008/11/04/understanding-flash-cs4-motion-xml/" target="_blank">documentation on CS4 Motion XML</a> that Flash engineer John Mayhew graciously put together.</p>
<p><strong>Step 4:</strong> Write the altered XML to the motion clipboard.</p>
<p><code>FLfile.write(MOTION_CLIPBOARD, motionXML.toXMLString());</code></p>
<p><strong>Step 5:</strong> Paste the altered motion.</p>
<p><code>tl.pasteMotion();</code></p>
<p><strong>Step 6:</strong> Restore the motion clipboard for the user.</p>
<p><code>FLfile.write(MOTION_CLIPBOARD, storedMotion);</code></p>
<p>If you want to know if a motion tween has already been applied, you can retrieve the <em>tweenType</em> property from the current frame. A classic tween will return a value of &#8220;<em>motion</em>&#8221; and a new motion tween will return a value of &#8220;<em>motion object</em>&#8220;. If you use Step 2(a), you&#8217;ll want to check and make sure you have a &#8220;motion object&#8221; selected before proceeding.</p>
<p>And there you have it.</p>
<p>There are other ways to go about this process. You could, since motion presets are just motion XML files, run this process through the <a href="http://help.adobe.com/en_US/Flash/10.0_ExtendingFlash/WS6F01C4D8-31E3-4d68-BB08-2E4C116DA70E.html" target="_blank">Motion Presets panel&#8217;s JSFL calls</a>, but this would require more steps than the process laid out above.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;bodytext=This%20JSFL%20technique%20can%20be%20used%20in%20Flash%20CS4%20in%20lieu%20of%20the%20non-existent%20timeline.createMotionObjectTween%28%29%20command.%20I%20refer%20to%20this%20as%20a%20%22hack%22%20because%20it%27s%20an%20unsupported%20method%2C%20but%20given%20the%20complexity%20of%20what%20can%20be%20created%20with%20this%20new%20motion%20model%2C%20editing%20the%20XML%20is%20actually%20a%20fairly%20efficient%20way%20to%20go%20about%20creating%2Fediting%20a%20tween.%20I%20used%20this%20technique%20to%20create%20the%20EaseCaddy%2C%20MotionSketch%2C%20and%20MotionBlur%20extensions." title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;notes=This%20JSFL%20technique%20can%20be%20used%20in%20Flash%20CS4%20in%20lieu%20of%20the%20non-existent%20timeline.createMotionObjectTween%28%29%20command.%20I%20refer%20to%20this%20as%20a%20%22hack%22%20because%20it%27s%20an%20unsupported%20method%2C%20but%20given%20the%20complexity%20of%20what%20can%20be%20created%20with%20this%20new%20motion%20model%2C%20editing%20the%20XML%20is%20actually%20a%20fairly%20efficient%20way%20to%20go%20about%20creating%2Fediting%20a%20tween.%20I%20used%20this%20technique%20to%20create%20the%20EaseCaddy%2C%20MotionSketch%2C%20and%20MotionBlur%20extensions." title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;t=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;annotation=This%20JSFL%20technique%20can%20be%20used%20in%20Flash%20CS4%20in%20lieu%20of%20the%20non-existent%20timeline.createMotionObjectTween%28%29%20command.%20I%20refer%20to%20this%20as%20a%20%22hack%22%20because%20it%27s%20an%20unsupported%20method%2C%20but%20given%20the%20complexity%20of%20what%20can%20be%20created%20with%20this%20new%20motion%20model%2C%20editing%20the%20XML%20is%20actually%20a%20fairly%20efficient%20way%20to%20go%20about%20creating%2Fediting%20a%20tween.%20I%20used%20this%20technique%20to%20create%20the%20EaseCaddy%2C%20MotionSketch%2C%20and%20MotionBlur%20extensions." title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=This%20JSFL%20technique%20can%20be%20used%20in%20Flash%20CS4%20in%20lieu%20of%20the%20non-existent%20timeline.createMotionObjectTween%28%29%20command.%20I%20refer%20to%20this%20as%20a%20%22hack%22%20because%20it%27s%20an%20unsupported%20method%2C%20but%20given%20the%20complexity%20of%20what%20can%20be%20created%20with%20this%20new%20motion%20model%2C%20editing%20the%20XML%20is%20actually%20a%20fairly%20efficient%20way%20to%20go%20about%20creating%2Fediting%20a%20tween.%20I%20used%20this%20technique%20to%20create%20the%20EaseCaddy%2C%20MotionSketch%2C%20and%20MotionBlur%20extensions." title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;title=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F&amp;t=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Hacking%20the%20Flash%20CS4%20Motion%20Model%20to%20Create%20New%20Extensions%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2009%2F03%2F04%2Fhacking-the-flash-cs4-motion-model-to-create-extensions%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2009/03/04/hacking-the-flash-cs4-motion-model-to-create-extensions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Control Things with Actionscript</title>
		<link>http://ajarproductions.com/blog/2008/10/20/how-to-control-things-with-actionscript/</link>
		<comments>http://ajarproductions.com/blog/2008/10/20/how-to-control-things-with-actionscript/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 22:08:20 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/?p=102</guid>
		<description><![CDATA[When working with other designers in Flash, I generally serve as the last line of defense for unsolved functionality mysteries. I often find that there's a mishap that has resulted from changed or lost instance names, effectively decapitating pieces of code. So how do you control things with Actionscript?]]></description>
			<content:encoded><![CDATA[<p>When working with other designers in Flash, I generally serve as the last line of defense for unsolved functionality mysteries. I often find that there&#8217;s a mishap that has resulted from changed or lost instance names, effectively decapitating pieces of code. So how do you control things with Actionscript?</p>
<p>The short answer: Instance Names.</p>
<p>For the detailed answer check out this <a href="http://ajarproductions.com/tutorials/?id=Control_Using_Actionscript1&#038;h=618">video tutorial</a> using Actionscript 3.</p>
<p>The Actionscript has to know &#8220;who&#8221; you&#8217;re wanting to talk to. Just as we know human beings by name, and talk about them and to them by name, Actionscript references objects by name. A teacher might tell &#8220;Timmy&#8221; to sit down. Accordingly, your script might tell &#8220;circle&#8221; to move 10 pixels to the left. If no symbol with the name, &#8220;circle&#8221; exists, nothing happens; just as no one sits down if there&#8217;s no &#8220;Timmy&#8221; in the classroom. </p>
<p>Referencing nested MovieClips works the same way, just add a dot inbetween:<br />
<code>var clipReference = grandparentClip.parentClip.childClip;</code></p>
<p>Remember that a symbol name is different than an instance name. You can have multiple instances of a symbol on stage, but each instance name has to be unique. Instance names are set in the Property Inspector, symbol names are set in the Library.</p>
<p>Keep this idea in mind when working with Actionscript and it will make your life a whole lot easier.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript&amp;bodytext=When%20working%20with%20other%20designers%20in%20Flash%2C%20I%20generally%20serve%20as%20the%20last%20line%20of%20defense%20for%20unsolved%20functionality%20mysteries.%20I%20often%20find%20that%20there%27s%20a%20mishap%20that%20has%20resulted%20from%20changed%20or%20lost%20instance%20names%2C%20effectively%20decapitating%20pieces%20of%20code.%20So%20how%20do%20you%20control%20things%20with%20Actionscript%3F" title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript&amp;notes=When%20working%20with%20other%20designers%20in%20Flash%2C%20I%20generally%20serve%20as%20the%20last%20line%20of%20defense%20for%20unsolved%20functionality%20mysteries.%20I%20often%20find%20that%20there%27s%20a%20mishap%20that%20has%20resulted%20from%20changed%20or%20lost%20instance%20names%2C%20effectively%20decapitating%20pieces%20of%20code.%20So%20how%20do%20you%20control%20things%20with%20Actionscript%3F" title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=How%20to%20Control%20Things%20with%20Actionscript&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;t=How%20to%20Control%20Things%20with%20Actionscript" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript&amp;annotation=When%20working%20with%20other%20designers%20in%20Flash%2C%20I%20generally%20serve%20as%20the%20last%20line%20of%20defense%20for%20unsolved%20functionality%20mysteries.%20I%20often%20find%20that%20there%27s%20a%20mishap%20that%20has%20resulted%20from%20changed%20or%20lost%20instance%20names%2C%20effectively%20decapitating%20pieces%20of%20code.%20So%20how%20do%20you%20control%20things%20with%20Actionscript%3F" title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=When%20working%20with%20other%20designers%20in%20Flash%2C%20I%20generally%20serve%20as%20the%20last%20line%20of%20defense%20for%20unsolved%20functionality%20mysteries.%20I%20often%20find%20that%20there%27s%20a%20mishap%20that%20has%20resulted%20from%20changed%20or%20lost%20instance%20names%2C%20effectively%20decapitating%20pieces%20of%20code.%20So%20how%20do%20you%20control%20things%20with%20Actionscript%3F" title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;title=How%20to%20Control%20Things%20with%20Actionscript" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F&amp;t=How%20to%20Control%20Things%20with%20Actionscript" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20Control%20Things%20with%20Actionscript&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20Control%20Things%20with%20Actionscript%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F10%2F20%2Fhow-to-control-things-with-actionscript%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2008/10/20/how-to-control-things-with-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Flash Extension: FrameSync</title>
		<link>http://ajarproductions.com/blog/2008/09/09/new-flash-extension-framesync/</link>
		<comments>http://ajarproductions.com/blog/2008/09/09/new-flash-extension-framesync/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 20:58:15 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[extensions]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/?p=45</guid>
		<description><![CDATA[This is a handy-dandy new animation plug-in for Flash.]]></description>
			<content:encoded><![CDATA[<p>This is a handy-dandy animation plug-in similar to Animonger&#8217;s <a href="http://www.animonger.com/flashtools.html">AnimSlider</a>, except that it uses frame labels and requires no other setup.</p>
<p><strong>Update</strong>: The <a href="http://ajarproductions.com/tutorials/?id=frameSync_tutorial&amp;h=618">video tutorial</a> is now live. See the extension in action!</p>
<p>I picked up this style of lip syncing in Flash from Chris Georgenes&#8217; <a href="http://www.adobe.com/devnet/flash/articles/lipsync_macrochat.html">tutorial</a>.</p>
<p><strong>Update (8/26/09)</strong>: A savvy user caught a stage refresh bug introduced in Flash CS4 with AS3. If you&#8217;re using Flash CS4 &amp; AS3 and the symbol isn&#8217;t updating when you select a new frame from the panel, download the most recent version below (1.0.3 has the fix).</p>
<p><img class="alignnone" title="FrameSync ScreenCap" src="http://ajarproductions.com/flash_extensions/images/FrameSync_screenCap.gif" alt="" width="499" height="337" /></p>
<h3>Download</h3>
<p><em>(compatible with Flash MX 2004, Flash 8, and Flash CS3)</em></p>
<p><a href="http://ajarproductions.com/flash_extensions/FrameSync.mxp">FrameSync.mxp</a></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync&amp;bodytext=This%20is%20a%20handy-dandy%20new%20animation%20plug-in%20for%20Flash." title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync&amp;notes=This%20is%20a%20handy-dandy%20new%20animation%20plug-in%20for%20Flash." title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=New%20Flash%20Extension%3A%20FrameSync&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;t=New%20Flash%20Extension%3A%20FrameSync" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync&amp;annotation=This%20is%20a%20handy-dandy%20new%20animation%20plug-in%20for%20Flash." title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=This%20is%20a%20handy-dandy%20new%20animation%20plug-in%20for%20Flash." title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;title=New%20Flash%20Extension%3A%20FrameSync" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F&amp;t=New%20Flash%20Extension%3A%20FrameSync" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=New%20Flash%20Extension%3A%20FrameSync&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=New%20Flash%20Extension%3A%20FrameSync%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2008%2F09%2F09%2Fnew-flash-extension-framesync%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2008/09/09/new-flash-extension-framesync/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Tutorial: A Simple Preloader, in detail</title>
		<link>http://ajarproductions.com/blog/2007/02/20/tutorial-a-simple-preloader-in-detail/</link>
		<comments>http://ajarproductions.com/blog/2007/02/20/tutorial-a-simple-preloader-in-detail/#comments</comments>
		<pubDate>Tue, 20 Feb 2007 05:00:56 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://ajarproductions.com/blog/2007/02/20/tutorial-a-simple-preloader-in-detail/</guid>
		<description><![CDATA[Preloaders are one of the simplest bits of underutilized Flash programming on the web. When making any kind of presentation on the web, whether it be an interactive experience or a self-running animation, it is important to consider user experience. It is important to be generous with the user, because we ask that they be [...]]]></description>
			<content:encoded><![CDATA[<p>Preloaders are one of the simplest bits of underutilized Flash programming<br />
on the web. When making any kind of presentation on the web, whether it be<br />
an interactive experience or a self-running animation, it is important to consider<br />
user experience. It is important to be generous with the user, because we ask<br />
that they be generous with us as they view our websites. Preloaders are also<br />
important because they may retain busy or impatient users who would otherwise<br />
think that nothing is going on when the page is merely loading without giving<br />
feedback.</p>
<p>Not everybody&#8217;s a programmer, though. So I&#8217;ve provided this detailed tutorial<br />
for anyone would like to add a preloader to their Flash web project.</p>
<h3>Getting started:</h3>
<p>I usually like to put the preloader in its own scene so that it doesn&#8217;t disturb<br />
my main timeline. If you&#8217;re not familiar with using scenes in Flash, a scene<br />
can be added in the following manner:<br />
- Window &gt; Other Panels &gt; Scene<br />
- click the &#8220;+&#8221; to add a new scene<br />
- drag it to the top<br />
- and double-click to rename it<br />
- I usually name it &#8220;preloader&#8221; and from hereon out I will refer to<br />
it as the preloader scene</p>
<p>Then make sure your actionscript is organized in its own layer in the preloader<br />
scene:<br />
- add a new layer and rename it to &#8216;actions&#8217;<br />
- lock the layer so nothing accidentally get placed on the stage for this layer<br />
- select the first keyframe on the actions layer and open the actions panel<br />
- the actions panel can be opened by hitting the f9 key or by going to Window &gt; Actions</p>
<p>Then enter the following code:</p>
<div class="codeBlock"><span class="AScomment">//loaderbar_mc is a movieClip containing a rectangle with its registration point at the left edge</span><br />
<span class="AScomment">//percent_txt is a dynamic text field<br />
//note the 3 different display options (A, B, C) </span></p>
<p><span class="ASfunc">stop</span><span class="actionscript">();</span></p>
<p><span class="actionscript">loaderbar_mc.</span><span class="ASfunc">_xscale</span> <span class="actionscript">=<br />
0;</span></p>
<p><span class="ASfunc">function</span>  preloading():<span class="ASfunc">Void</span>{<br />
<span class="ASfunc">var</span>  bLoaded:<span class="ASfunc">Number</span> = <span class="ASfunc">getBytesLoaded</span>();<br />
<span class="ASfunc">var</span>  bTotal:<span class="ASfunc">Number</span> = <span class="ASfunc">getBytesTotal</span>();<br />
<span class="ASfunc">var</span>  percentL:<span class="ASfunc">Number</span> = (bLoaded / bTotal)<span class="ASfunc"> *</span> 100;</p>
<p class="ASindent"> <span class="ASfunc">if</span> (percentL <span class="ASfunc">&lt;</span> 100){<br />
<span class="AScomment">// (A) if you want to show text in the form of xx% loaded</span><br />
percent_txt.<span class="ASfunc">text</span> = <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(percentL) + <span class="ASstring">&#8220;% loaded&#8221;</span><span class="actionscript">;</span><br />
<span class="AScomment">// (B) if you want to show text in the form of xx Kb loaded/ xx Kb total </span><br />
percent_txt.<span class="ASfunc">text</span> = <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(bLoaded<span class="ASfunc">/</span>1000) <span class="ASfunc">+</span> <span class="ASstring">&#8221; Kb / &#8220;</span> <span class="ASfunc">+</span> <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(bTotal<span class="ASfunc">/</span>1000) <span class="ASfunc">+</span> <span class="ASstring">&#8221; Kb&#8221;</span> <span class="actionscript">;</span><br />
<span class="AScomment">// (C) if you want a loaderbar to grow with the % loaded </span><br />
loaderbar_mc.<span class="ASfunc">_xscale</span> = percentL;<br />
} <span class="ASfunc">else</span> {<br />
<span class="ASfunc">clearInterval</span>(loaderInterval);<br />
<span class="ASfunc">play</span>();<br />
}</p>
<p>}</p>
<p>loaderInterval = <span class="ASfunc">setInterval</span>(preloading,25);</p>
<p><span class="AScomment">//make sure there&#8217;s a stop command on your main scene if it&#8217;s a one frame app</span>
</div>
<p>Now for a detailed description of what everything does:</p>
<p><span id="more-4"></span></p>
<p class="codeBlock"><span class="ASfunc">stop</span><span class="actionscript">();</span></p>
<p>The stop() command tells the playhead to halt but allows the code on the stopped<br />
frame to run.</p>
<p class="codeBlock"><span class="actionscript">loaderbar_mc.</span><span class="ASfunc">_xscale</span> <span class="actionscript">= 0;</span></p>
<p>This code initializes the &#8216;_xscale&#8217; property of an instance with the name<br />
&#8216;loaderbar_mc&#8217; so that it has no width (because the movie has just begun loading).<br />
This is basically a rectangular movieClip. The instance name is applied via<br />
the properties inspector panel. Select the loaderbar movieClip on the stage<br />
(it needs to be in the preloader scene if you chose to do this the way I&#8217;ve<br />
listed). Make sure your symbol is a movieClip. Graphic symbols cannot have<br />
instance names and are therefore inaccessible with ActionScript.</p>
<p class="codeBlock"><span class="ASfunc">function</span> preloading():<span class="ASfunc">Void</span>{<br />
<span class="ASfunc">var</span> bLoaded:<span class="ASfunc">Number</span> = <span class="ASfunc">getBytesLoaded</span>();<br />
<span class="ASfunc">var</span> bTotal:<span class="ASfunc">Number</span> = <span class="ASfunc">getBytesTotal</span>();<br />
<span class="ASfunc">var</span> percentL:<span class="ASfunc">Number</span> = (bLoaded<span class="ASfunc"></span> bTotal) <span class="ASfunc">*</span> 100;</p>
<p>This is the beginning of a custom function that I&#8217;ve written called &#8216;preloading&#8217;.<br />
The word &#8216;function&#8217; is used to begin the function, then the function name.<br />
The parentheses are empty because no variables are being sent to the function.<br />
The word &#8216;Void&#8217; tells the application that the function is not returning any<br />
variables, and the curly bracket begins the content of the function.</p>
<p>The next 3 lines are variable declarations. The &#8216;:Number&#8217; is what&#8217;s called<br />
strict data-typing. It tells Flash that this variable should be a number. If<br />
I try to load it with a string variable (&#8220;atom&#8221; for instance) or<br />
a boolean value (TRUE or FALSE), Flash will report an error in the output panel.</p>
<p>The first variable retrieves the bytes loaded by Flash, the second retrieves<br />
the total bytes, and the third divides the current loaded bytes by the total<br />
bytes to get a percentage (multiplying by 100 gets it into the form we&#8217;re used<br />
to, like 56 instead of .56&#8211;we&#8217;ll add the percent sign next).</p>
<p class="codeBlock"><span class="ASfunc">if</span> (percentL <span class="ASfunc">&lt;</span> 100){<br />
<span class="AScomment">// (A) if you want to show text in the form of xx% loaded</span><br />
percent_txt.<span class="ASfunc">text</span> = <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(percentL) + <span class="ASstring">&#8220;% loaded&#8221;</span><span class="actionscript">;</span><br />
<span class="AScomment">// (B) if you want to show text in the form of xx Kb loaded/ xx Kb total </span><br />
percent_txt.<span class="ASfunc">text</span> = <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(bLoaded<span class="ASfunc">/</span>1000) <span class="ASfunc">+</span> <span class="ASstring">&#8221; Kb / &#8220;</span> <span class="ASfunc">+</span> <span class="ASfunc">Math</span>.<span class="ASfunc">round</span>(bTotal<span class="ASfunc">/</span>1000) <span class="ASfunc">+</span> <span class="ASstring">&#8221; Kb&#8221;</span> <span class="actionscript">;</span><br />
<span class="AScomment">// (C) if you want a loaderbar to grow with the % loaded </span><br />
loaderbar_mc.<span class="ASfunc">_xscale</span> = percentL;<br />
}</p>
<p>This next block is an &#8216;if&#8217; statement. The content of the if statement is contained<br />
in curly brackets just like our function (which we are still inside). The code<br />
inside the parentheses is the statement that drives this command; as long as<br />
it&#8217;s true, the lines inside the if statement&#8217;s curly brackets will continue<br />
to run. In this case it&#8217;s checking to see if the percentL variable we created<br />
in the previous line is less than 100.</p>
<p>The lines that begin with &#8216;//&#8217; are merely comments for reference, they have no affect on the code. They represent 3 different<br />
options I have provided for displaying feedback to the user. They can be used<br />
seperately or in combination. Make sure to delete the items you don&#8217;t use or<br />
comment them out by adding two slashes (&#8216;//&#8217;) at the beginning of the line.<br />
The &#8216;percent_txt&#8217; refers to a dynamic text box on the stage with the instance<br />
name &#8216;percent_txt.&#8217; This text box must be set to &#8216;Dynamic text&#8217; in the Property<br />
Inspector to give it an instance name that we can reference with ActionScript.<br />
I usually choose a web font (verdana or arial) and select &#8216;Use device fonts&#8217;<br />
from the Property Inspector. This utilizes the user&#8217;s own fonts and keeps the<br />
Flash file size low. The alternative is embedding a font, and depending on<br />
the font, that can add a lot of girth to an swf.</p>
<p>The first two options (A and B) are merely  concatenations (lumping bits together<br />
into a string of text). I use Flash&#8217;s built-in Math.round function to round<br />
to whole numbers for a less cluttered display. The third option (C) uses the<br />
&#8216;percentL&#8217; variable that was created earlier to determine the size of our loaderbar_mc<br />
movieClip, hence the loaderbar will seem to grow.</p>
<p>Finally we close out the &#8216;if&#8217; statement with a curly brace.</p>
<p class="codeBlock"> <span class="ASfunc">else</span> {<br />
<span class="ASfunc">clearInterval</span>(loaderInterval);<br />
<span class="ASfunc">play</span>();<br />
}</p>
<p>Next, we use an &#8216;else&#8217; statement to clear the &#8216;loaderInterval&#8217; (which I&#8217;ll<br />
explain in a second), and play() the main timeline (i.e., start the movie).<br />
The else statement is what gets called when the condition within the if statement<br />
(percentL &lt; 100), is no longer true (because the movie is completely loaded,<br />
100%).</p>
<p class="codeBlock">}<br />
loaderInterval = <span class="ASfunc">setInterval</span>(preloading,25);</p>
<p>Finally we close out the function with a curly bracket and we&#8217;ve come to the<br />
interval. An interval is something that occurs repeatedly until it&#8217;s cleared.<br />
This is an alternative to using &#8216;onEnterFrame.&#8217; I&#8217;ve stopped using onEnterFrame<br />
because I like the versatility of using intervals.</p>
<p>This bit of code actually gets called before the &#8216;preloading&#8217; function, because<br />
a function must be <em>called</em>  in order to run. In this case the preloading<br />
function is getting called every 25 milliseconds or 40 times/second. This allows<br />
for smooth animation of the loaderbar even if the swf is only set to 12 frames/second.<br />
Whereas, onEnterFrame will only run at the document&#8217;s  frame rate.</p>
<p>First we need to declare<br />
the interval with a variable name so that it can be referenced and cleared<br />
in our &#8216;else&#8217; statement, hence &#8216;loaderInterval.&#8217; Next we use the setInterval<br />
function and two of its paramenters to call the preloading function from above<br />
every 25 milliseconds. That means that &#8216;preloading&#8217; will be called over and<br />
over until the percentL variable reaches 100.</p>
<p>Clearing the interval is important<br />
because it is memory intensive to have the user&#8217;s CPU calling a function over<br />
and over, especially when other things are occurring within the swf. That&#8217;s<br />
why we clear the loaderInterval once we&#8217;re done using it. I called this variable<br />
&#8216;loaderInterval&#8217; because that&#8217;s its purpose in this code, but an interval can<br />
be named just about anything.</p>
<h3>Testing The Preloader</h3>
<p>To test your movie go to Control &gt; Test Movie. You&#8217;ll notice the preloader<br />
scene shows very quickly if at all. That&#8217;s because we&#8217;re testing it locally.<br />
To see what it would look like in action go to View &gt; Simulate Download. You<br />
can change the speed of the connection that&#8217;s being simulated by going to View<br />
&gt; Download settings and selecting a different speed.</p>
<p>That&#8217;s it!</p>
<p>A quick note:<br />
This preloader code is designed for ActionScript 2 (Macromedia Flash MX 2004<br />
or later, Flash player 6/7 or later). To make this code function in ActionScript<br />
1,  remove all of the strict data-typing (basically everything beginning<br />
with a colon&#8211;:Number and :Void).</p>
<p>Happy Flashing!</p>
<p>-Justin</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;bodytext=Preloaders%20are%20one%20of%20the%20simplest%20bits%20of%20underutilized%20Flash%20programming%0D%0Aon%20the%20web.%20When%20making%20any%20kind%20of%20presentation%20on%20the%20web%2C%20whether%20it%20be%0D%0Aan%20interactive%20experience%20or%20a%20self-running%20animation%2C%20it%20is%20important%20to%20consider%0D%0Auser%20experienc" title="Digg"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;notes=Preloaders%20are%20one%20of%20the%20simplest%20bits%20of%20underutilized%20Flash%20programming%0D%0Aon%20the%20web.%20When%20making%20any%20kind%20of%20presentation%20on%20the%20web%2C%20whether%20it%20be%0D%0Aan%20interactive%20experience%20or%20a%20self-running%20animation%2C%20it%20is%20important%20to%20consider%0D%0Auser%20experienc" title="del.icio.us"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F" title="Fark"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail" title="StumbleUpon"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;t=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail" title="Facebook"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;annotation=Preloaders%20are%20one%20of%20the%20simplest%20bits%20of%20underutilized%20Flash%20programming%0D%0Aon%20the%20web.%20When%20making%20any%20kind%20of%20presentation%20on%20the%20web%2C%20whether%20it%20be%0D%0Aan%20interactive%20experience%20or%20a%20self-running%20animation%2C%20it%20is%20important%20to%20consider%0D%0Auser%20experienc" title="Google Bookmarks"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;source=Ajar+Productions+Animation+%7C+Design+%7C+Development&amp;summary=Preloaders%20are%20one%20of%20the%20simplest%20bits%20of%20underutilized%20Flash%20programming%0D%0Aon%20the%20web.%20When%20making%20any%20kind%20of%20presentation%20on%20the%20web%2C%20whether%20it%20be%0D%0Aan%20interactive%20experience%20or%20a%20self-running%20animation%2C%20it%20is%20important%20to%20consider%0D%0Auser%20experienc" title="LinkedIn"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;title=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail" title="Reddit"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F" title="Technorati"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F&amp;t=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail" title="MySpace"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail&amp;body=http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F" title="email"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Tutorial%3A%20A%20Simple%20Preloader%2C%20in%20detail%20-%20http%3A%2F%2Fajarproductions.com%2Fblog%2F2007%2F02%2F20%2Ftutorial-a-simple-preloader-in-detail%2F" title="Twitter"><img src="http://ajarproductions.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://ajarproductions.com/blog/2007/02/20/tutorial-a-simple-preloader-in-detail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
