<?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>Blowing Through Lines &#187; CS3</title>
	<atom:link href="http://blowingthroughlines.com/category/cs3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blowingthroughlines.com</link>
	<description>Highly addictive code.</description>
	<lastBuildDate>Tue, 31 Jan 2012 21:49:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Automatic Bending Joints in As3 (Simple Bones)</title>
		<link>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/</link>
		<comments>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 22:32:40 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2008/02/10/flash-as3/automatic-bending-joints-in-as3-simple-bones/</guid>
		<description><![CDATA[This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features. So I had this idea: I&#8217;m working with a bunch [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features.</p>
<h3>So I had this idea:</h3>
<p>I&#8217;m working with a bunch of designer&#8217;s who are really good with illustrator, and keyframe animating, but don&#8217;t have the time to animate all the movements (each head, body, upper arm x2 lower arm x2, legs, hands, feet&#8230; well you get the idea). So I needed a way to reduce the number of animations that the designers would be needed for, but also not create too many Tweeners or other hard coded animation solutions. I really needed <a href="http://aralbalkan.com/1072" target="_blank" title="Animated IK (bones) in Diesel (Flash CS4)">bones</a>, but those don&#8217;t seem to be arriving for a while, so the next best thing was automatically animated elbows (and knees). Fortunately for me the illustrator I was working with designed the robot&#8217;s arms and legs with even length upper and lower lengths so I could do some trig and get this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p35code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p352"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p35code2"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> theta:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">acos</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>distance<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>limbL<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">limb</span>.<span style="color: #006600;">rotation</span> =  baseRotation - theta;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">omoLimb</span>.<span style="color: #006600;">rotation</span> = theta <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;</pre></td></tr></table></div>

<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" width="500" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
<span class="caption">Click and drag the hand or foot to see the automagic joint rotation</span></p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/02/blowingthroughlines_joint.zip' title='AS3 Joint class source'>AS3 Joint class source file</a></p>
<p>Right now it&#8217;s limited to even length bones, but my little brother with the physics and math degrees, says he has a better equation, so as soon as I have time I&#8217;ll update the classes. A public SVN repository is in the works too, stay tuned.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accordion Meets XML</title>
		<link>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/</link>
		<comments>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 06:53:40 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2008/01/27/flash-as3/accordion-meets-xml/</guid>
		<description><![CDATA[So a reader asked how to implement our accordion script using XML to populate it, and I think the results aren&#8217;t half bad. I&#8217;m not sure what he meant by a cervical shaped accordion though&#8230; Circular maybe? hopefully? (Please open the article to see the flash file or player.) source files for the xml&#8217;d accordion [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>So a reader asked how to implement <a href="http://blowingthroughlines.com/2007/09/17/flash-as3/accordion-component-as3-flash-9/">our accordion script</a> using XML to populate it, and I think the results aren&#8217;t half bad. I&#8217;m not sure what he meant by a <em>cervical</em> shaped accordion though&#8230; Circular maybe? hopefully?</p>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/01/accordionxml.swf" width="500" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/01/accordionxml.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/01/accordion_xml.zip' title='source files for the xmled accordion'>source files for the xml&#8217;d accordion</a></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code5'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p305"><td class="code" id="p30code5"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;wp-content/xml/images.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
	loader = <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;
	loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, loadComplete<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loadComplete<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">data</span> = <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	accord = <span style="color: #000000; font-weight: bold;">new</span> accordion<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">500</span>, <span style="color: #cc66cc;">400</span>, <span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; i++<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> panel:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> NavPanel<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> contents:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> ImgHolder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">img</span><span style="color: #66cc66;">&#41;</span>;
		accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span>panel, contents<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	addChild<span style="color: #66cc66;">&#40;</span>accord<span style="color: #66cc66;">&#41;</span>;
	accord.<span style="color: #006600;">openPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code6'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p306"><td class="code" id="p30code6"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel one<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1905143678_218d1aa13a.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel zwei<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904306625_fa9cf2cd33.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel tre<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904436509_2266d2daf2.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel quattre<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904437975_441fec52af.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Flash Input Text Bug</title>
		<link>http://blowingthroughlines.com/2007/12/08/cs3/flash-input-text-bug/</link>
		<comments>http://blowingthroughlines.com/2007/12/08/cs3/flash-input-text-bug/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 17:59:35 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[CS3]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2007/12/08/cs3/flash-input-text-bug/</guid>
		<description><![CDATA[The other day I was throwing an email form together really quickly, and decided to lay it out on the stage. So added 4 input fields, for name, email, subject, and message, and used those names as the instance names. then i put some labels in them, since i was planning on doing some nice [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The other day I was throwing an email form together really quickly, and decided to lay it out on the stage. So added 4 input fields, for <em>name</em>, <em>email</em>, <em>subject</em>, and <em>message</em>, and used those names as the instance names. then i put some labels in them, since i was planning on doing some nice ON_FOCUS text relacement. but before going much farther i needed to check to see if the alignment was right, and tested the movie.<br />
At which point I quite unexpectedly got this error:</p>
<pre>Error: Error #2078: The name property of a Timeline-placed object cannot be modified.
	at flash.display::DisplayObject/set name()
	at flash.display::Sprite/flash.display:Sprite::constructChildren()
	at flash.display::Sprite$iinit()
	at flash.display::MovieClip$iinit()</pre>
<p><br/>And I hadn&#8217;t even imported the form class I had used a dozen times before&#8230; </p>
<p><span id="more-25"></span></p>
<h3>Solution</h3>
<p>The Flash IDE has some reserved instance names stored in it that will give you immediate warnings when you try to use them (try entering <em>name txt</em>) <em>name</em> isn&#8217;t one of the reserved words, but&mdash;at least for input text fields&mdash;it should be.<br />
Seems like they could have saved users some time and frustration by reserving that word in the IDE so that it can&#8217;t be entered.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/12/08/cs3/flash-input-text-bug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Animator Class Enhancement</title>
		<link>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/</link>
		<comments>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 21:07:35 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/uncategorized/nilloc/animator-class-enhancement/</guid>
		<description><![CDATA[I don&#8217;t know how much exploration of the Animator class many people have done out there, but a current project seemed like a good place to experiment with it. I&#8217;m pretty impressed with Adobe&#8217;s implementation of it&#8212;though I&#8217;m far more impressed with the capabilities of E4X XML tools that make it possible&#8212;but some things are [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how much exploration of the Animator class many people have done out there, but a current project seemed like a good place to experiment with it. I&#8217;m pretty impressed with Adobe&#8217;s implementation of it&mdash;though I&#8217;m far more impressed with the capabilities of E4X XML tools that make it possible&mdash;but some things are less then ready for prime-time.</p>
<p>Basically, flashes Animator.play()</p>
<h3>Example</h3>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2007/10/animatorspeed.swf" width="500" height="250" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2007/10/animatorspeed.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<h3>How it works</h3>
<p>This Assumes the code is on frame 1 of the main timeline.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p19code8'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p198"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre></td><td class="code" id="p19code8"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">motion</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//stage.frameRate = fps;</span>
<span style="color: #808080; font-style: italic;">//trace(stage.frameRate);</span>
<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*************  this is the speed controller (or delay controller) *************/</span>
<span style="color: #000000; font-weight: bold;">var</span> player:Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">33</span>,<span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// &quot;33&quot;/1000th of a second is pretty much 30 fps and the animation is &quot;30&quot; frames long</span>
	player.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>, playAnimator<span style="color: #66cc66;">&#41;</span>;
	player.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> playAnimator<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:TimerEvent<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">currentCount</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		ner_animator.<span style="color: #0066CC;">time</span> = <span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">currentCount</span>;
	<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
		ner_animator.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		ner_animator.<span style="color: #006600;">rewind</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		player.<span style="color: #006600;">reset</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		player.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************* speed controlled animator (taken straight from the clipboard but with the Animator.play() removed *************/</span>
<span style="color: #000000; font-weight: bold;">var</span> ner_xml:<span style="color: #0066CC;">XML</span> = <span style="color: #66cc66;">&lt;</span>motion <span style="color: #0066CC;">duration</span>=<span style="color: #ff0000;">&quot;30&quot;</span> xmlns=<span style="color: #ff0000;">&quot;fl.motion.*&quot;</span> xmlns:geom=<span style="color: #ff0000;">&quot;flash.geom.*&quot;</span> xmlns:filters=<span style="color: #ff0000;">&quot;flash.filters.*&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>source<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>source frameRate=<span style="color: #ff0000;">&quot;10&quot;</span> x=<span style="color: #ff0000;">&quot;95&quot;</span> y=<span style="color: #ff0000;">&quot;114&quot;</span> scaleX=<span style="color: #ff0000;">&quot;1&quot;</span> scaleY=<span style="color: #ff0000;">&quot;1&quot;</span> rotation=<span style="color: #ff0000;">&quot;0&quot;</span> elementType=<span style="color: #ff0000;">&quot;movie clip&quot;</span> instanceName=<span style="color: #ff0000;">&quot;ner&quot;</span> symbolName=<span style="color: #ff0000;">&quot;Symbol 1&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>dimensions<span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>geom:Rectangle <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;42&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;42&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>dimensions<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>transformationPoint<span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>geom:Point x=<span style="color: #ff0000;">&quot;0.5&quot;</span> y=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>transformationPoint<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>source<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>source<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>keyframe <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;0&quot;</span> tweenSnap=<span style="color: #ff0000;">&quot;true&quot;</span> tweenSync=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>tweens<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>simpleEase ease=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>tweens<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>keyframe<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>keyframe <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;29&quot;</span> tweenSync=<span style="color: #ff0000;">&quot;true&quot;</span> x=<span style="color: #ff0000;">&quot;253&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;/</span>motion<span style="color: #66cc66;">&gt;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> ner_animator:Animator = <span style="color: #000000; font-weight: bold;">new</span> Animator<span style="color: #66cc66;">&#40;</span>ner_xml, ner<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//ner_animator.play(); // removed because we play it with the new player function</span></pre></td></tr></table></div>

<p>So as you can see, it&#8217;s just replacing whatever the built in play() function does (likely some kind of onEnterFrame event) with a Timer driven, and thus framerate independent animation. Which allows old slow computers to keep things moving more like the Tween or Tweener class, frames will be skipped to keep the timing more or less on track (as much as possible).</p>
<p>I&#8217;m planning on releasing an class that extends the Animator class built into flash&mdash;or possibly building a new one from scratch&mdash;that will include this speed feature as well as other enhancements I&#8217;ve required in the last project (also coming soon).</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

