<?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>DrPunchBlog &#187; ActionScript</title>
	<atom:link href="http://yo.drpunchman.com/category/code/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://yo.drpunchman.com</link>
	<description>Living the feaver dream.</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Loop Faster, Damnit!</title>
		<link>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/</link>
		<comments>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 19:07:16 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Beer]]></category>
		<category><![CDATA[faster code]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7911</guid>
		<description><![CDATA[Taking your loops from 0.03 to 0.02+/-! A while ago, I was talking (probably here somewhere) about increasing the speed of FOR loops in ActionSctipt. They both do the same thing, but with the variables pre-defined, the second FOR is faster. It isn&#8217;t trying to run a function AND calculate the length of an an [...]]]></description>
			<content:encoded><![CDATA[<p>Taking your loops from 0.03 to 0.02+/-!</p>
<p>A while ago, I was talking (probably here somewhere) about increasing the speed of FOR loops in ActionSctipt.</p>
<pre class="brush: as3; title: ; notranslate">
var arr:Array = new Array(&quot;kittens&quot;,&quot;bunnies&quot;,&quot;puppies&quot;,&quot;whores dressed like french maids&quot;);
// slow:
for( var i:uint = 0; i &lt; arr.length(); i++ )
{
trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}

// fast:
var i:uint = 0;
var l:uint = arr.length();
for( i; i &lt; l; i++ )
 {
      trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
 }

// personal favorite (although I need to test the speed)
var i:uint = 0;
for( i in arr )
{
trace( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}
</pre>
<p>They both do the same thing, but with the variables pre-defined, the second FOR is faster. It isn&#8217;t trying to run a function AND calculate the length of an an array.</p>
<p>For jQuery, the effect is the same &#8212; my guess is that is a global coding thing.<br />
Although, it goes counter to conventional thinking (having more code on the page = slower load), the truth is: cleanly defined variables will produce faster (efficient) processing, even if it does mean more lines of code.</p>
<pre class="brush: jscript; title: ; notranslate">
// slow
$(&quot;.cuteStuff&quot;).each( function()
{
    for ( var arr, i = -1; arr = $arr[++i] )
    {
        document.write( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
    }
});
// faster
var $arr = $(&quot;#cuteStuff&quot;); &lt;!-- ID's are faster then CLASSES --&gt;
for ( var arr, i = -1; arr = $arr[++i] )
{
    document.write( &quot;Things that are cute: &quot; + arr[i] + &quot;. &quot;);
}
</pre>
<p>Here the main difference is that in the &#8220;slow&#8221; example, you are calling a function every time the page reads a div tag. (Think of it like, each div tag is a glass of beer, you find it drink it, and move on to the next.)<br />
In the &#8220;fast&#8221; example you are putting all the div tags into a make-shift array and just chugging it. (This time you are pouring each div tag into a beer bong and now chug them all at once.)</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/11/18/loop-faster-damnit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ND3D: The Revenge.</title>
		<link>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/</link>
		<comments>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 06:16:01 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[ASE]]></category>
		<category><![CDATA[Banner]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Modo]]></category>
		<category><![CDATA[Mustachio]]></category>
		<category><![CDATA[Zero]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7890</guid>
		<description><![CDATA[An update to last year&#8217;s ND3D banner test. Now it is all about, fitting it in the pipeline. The major issue is that creating an ASE file is stupid. 3Ds Max makes .ASE files, and 3Ds Max is for fools. Thanks to SupaMonke (again) for saving my skin. Harry, found a plugin, it didn&#8217;t work, [...]]]></description>
			<content:encoded><![CDATA[<p>An update to last year&#8217;s ND3D banner test.<br />
<img class="aligncenter size-medium wp-image-7891" title="Viva La 3D" src="http://yo.drpunchman.com/wp-content/uploads/2011/11/jiri-ruzek-3d-vikencia-01-300x202.jpg" alt="" width="300" height="202" /><br />
Now it is all about, fitting it in the pipeline.</p>
<p>The major issue is that creating an ASE file is stupid.<br />
3Ds Max makes .ASE files, and 3Ds Max is for fools.</p>
<p><span id="more-7890"></span>Thanks to <a href="http://www.supamonke.com/" target="_blank">SupaMonke</a> (again) for saving my skin. Harry, found a plugin, it didn&#8217;t work, so he rebuilt it. He is insane.</p>
<p>So&#8230;</p>
<ol>
<li>Download <a href="http://www.nulldesign.de/projects/nd3d-as3-3d-engine/" target="_blank">ND3D</a></li>
<li>Build your file in <a href="http://www.luxology.com/modo/" target="_blank">Modo</a></li>
<li>Use Harry&#8217;s <a href="http://drpunchman.com/_downloads/ND3D_fix.zip" target="_blank">plugin</a></li>
<li>Export an ASE file</li>
<li>Open the ASE file in TextEdit</li>
<ol>
<li>copy the &#8220;*MESH_VERTEX&#8221; bit with all the numbers</li>
<li>convert the numbers into an array [0,-0.3400 0.6099,0.3464],[1,-0.3400,0.5570,0.5080],[...</li>
</ol>
<li>Duplicate one of the objects in the <em>de/nulldesign/nd3d/objects/</em> folder.</li>
<li>Name it whatever, and remember to name the class and constructor to match...</li>
<li>Drop the array in (ok, I'm just getting tired writing this, I'm going to coast along for the rest of this... read my other post [<a href="http://yo.drpunchman.com/2010/03/03/nd3d-make-your-own-primitives/" target="_blank">here</a>] to figure this shit out&#8230; I&#8217;m going to ramble).</li>
<li>Oh, hi- you’re the phone guy right?</li>
<li>That’s what it says on my van!</li>
<li>Great, well, why don’t you just come in and get started… I’ve been having problems with my phone connection.</li>
<li>Hmmm, well it looks to me someone put this weird plastic thing where the tin can goes.</li>
<li>Ya! You’ve got quite the sense of humor.</li>
<li>No, seriously… what is this?</li>
<li>You’re kidding right? It’s a phone…</li>
<li>pulling wires, and a loud SHOCK</li>
<li>HOLLY MOTHER! That thing bit me! What are all these little colored metal things?</li>
<li>Those are wires… phone wires- for the phone. And I think it shocked you… with e-lec-tricity</li>
<li>E-lect-what now?</li>
<li>End Scene.</li>
<li>&#8230;and you&#8217;re done!</li>
</ol>
<div>&#8230;fuck it, here is a picture of a frenchman with a mustache:<br />
<img class="aligncenter size-full wp-image-7892" title="Mustachio" src="http://yo.drpunchman.com/wp-content/uploads/2011/11/Mustachio.jpg" alt="" width="600" height="379" /></div>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/11/06/nd3d-the-revenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/11/jiri-ruzek-3d-vikencia-01-150x150.jpg" length="8474" type="image/jpg" />	</item>
		<item>
		<title>Bring the noise!</title>
		<link>http://yo.drpunchman.com/2011/10/28/bring-the-noise/</link>
		<comments>http://yo.drpunchman.com/2011/10/28/bring-the-noise/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 22:03:34 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actionscript 2.0]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[noise]]></category>
		<category><![CDATA[perlinNoise]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7876</guid>
		<description><![CDATA[Dynamically generated noise patterns. If you want an interactive example click [here]. After the jump is the AS2 code I&#8217;ve been playing with. It&#8217;s pretty rough, but you&#8217;ll get the idea. It attaches to a movie clip named &#8220;bg&#8221;. for help with filters click [here].]]></description>
			<content:encoded><![CDATA[<p>Dynamically generated noise patterns.<br />
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/10/Screen-shot-2011-10-28-at-3.09.40-PM.png" alt="" title="More Power" width="483" height="86" class="aligncenter size-full wp-image-7881" /><br />
If you want an interactive example click [<a href="http://polygeek.com/1780_flex_explorer-bitmapdata-perlin-noise" target="_blank">here</a>].</p>
<p>After the jump is the AS2 code I&#8217;ve been playing with.<br />
<span id="more-7876"></span><br />
It&#8217;s pretty rough, but you&#8217;ll get the idea.<br />
It attaches to a movie clip named &#8220;bg&#8221;.</p>
<pre class="brush: as3; title: ; notranslate">
import flash.display.BitmapData;
import flash.display.DisplayObject.blendMode;
import flash.display.BlendMode;
import flash.filters.*;
// NOISE -----------------------------

var bmp3:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc3:MovieClip = bg.createEmptyMovieClip(&quot;noise3&quot;, bg.getNextHighestDepth() );
mc3.attachBitmap(bmp3, this.getNextHighestDepth());
bmp3.noise( 11, 22, 234, 15, true);
mc3.blendMode = 13;
mc3._alpha = 70;

var bmp:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc:MovieClip = bg.createEmptyMovieClip(&quot;noise&quot;, bg.getNextHighestDepth() );
mc.attachBitmap(bmp, this.getNextHighestDepth());
var randomNum:Number = Math.floor(Math.random() * 50 ) + 50;
bmp.perlinNoise( 351, 91, 15, randomNum, false, false, 8, true);

mc.blendMode = 14;
mc._alpha = 70;

var bmp2:BitmapData = new BitmapData(Stage.width, Stage.height );
var mc2:MovieClip = bg.createEmptyMovieClip(&quot;noise2&quot;, bg.getNextHighestDepth() );
mc2.attachBitmap(bmp2, this.getNextHighestDepth());
var randomNum2:Number = Math.floor(Math.random() * 50 ) + 50;
bmp2.perlinNoise( 96, 277, 15, randomNum2, false, true, 8, true);
mc2.blendMode = 13;
mc2._alpha = 70;

var ds:DropShadowFilter = new DropShadowFilter( 3, -45, 0x000000, 100, 2, 2, 3, 3, false, false, false );
mc.filters = [ds];
</pre>
<p>for help with filters click [<a href="http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001282.html" target="_blank">here</a>].</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/10/28/bring-the-noise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/10/Screen-shot-2011-10-28-at-3.09.40-PM-150x86.png" length="26748" type="image/jpg" />	</item>
		<item>
		<title>Honda Trip Planner</title>
		<link>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/</link>
		<comments>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 02:41:10 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[Banner]]></category>
		<category><![CDATA[Honda]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=2051</guid>
		<description><![CDATA[Banner for the MCAV Trip Planner. No, I do not know what any of that means.]]></description>
			<content:encoded><![CDATA[<p>Banner for the MCAV Trip Planner.<br />
No, I do not know what any of that means.<br />
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.jpg" alt="" title="MCAV TripPlanner 160x600" width="160" height="600" class="alignleft size-full wp-image-2052" /><br />
<span id="more-2051"></span><br />

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="160" height="600">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600.swf" width="160" height="600">
      <!--<![endif]-->
        MCAV Trip-Planner 160&#215;600 banner
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/25/honda-trip-planner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/04/MCAV_TripPlanner_160x600-150x150.jpg" length="10564" type="image/jpg" />	</item>
		<item>
		<title>Honda CBR 250R Banner</title>
		<link>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/</link>
		<comments>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 02:45:28 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[banners]]></category>
		<category><![CDATA[CBR 250R]]></category>
		<category><![CDATA[Honda]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=2055</guid>
		<description><![CDATA[Here is one of the banners that I worked on for the Honda CBR 250R. Who names these bikes?]]></description>
			<content:encoded><![CDATA[<p>Here is one of the banners that I worked on for the Honda CBR 250R.<br />
Who names these bikes?</p>
<table>
<tr>
<td>
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.jpg" alt="" title="cbr250r_road_300x250" width="300" height="250" class="alignleft size-full wp-image-2056" />
</td>
<td>
<img src="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.jpg" alt="" title="cbr250r_road_160x90" width="160" height="90" class="alignleft size-full wp-image-2057" />
</td>
</tr>
</table>
<p><span id="more-2055"></span></p>
<table>
<tr>
<td>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        cbr250r road 300&#215;250
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

</td>
<td>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_2" width="160" height="90">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_160x90.swf" width="160" height="90">
      <!--<![endif]-->
        cbr250r road 160&#215;90
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/24/honda-cbr-250r-banner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://yo.drpunchman.com/wp-content/uploads/2011/04/cbr250r_road_300x250-150x150.jpg" length="8994" type="image/jpg" />	</item>
		<item>
		<title>Honda Banners: Become a Dealer!</title>
		<link>http://yo.drpunchman.com/2011/08/14/amazing-honda-banners/</link>
		<comments>http://yo.drpunchman.com/2011/08/14/amazing-honda-banners/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 04:31:43 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[asians]]></category>
		<category><![CDATA[Honda]]></category>
		<category><![CDATA[killer robots]]></category>
		<category><![CDATA[Power-Sports]]></category>
		<category><![CDATA[powersports]]></category>
		<category><![CDATA[watersports]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=4199</guid>
		<description><![CDATA[Honda Power-Sports are coming to your town. Like a wrecking ball hungry for bricks. OK, I&#8217;m a little sleepy, and a lot drunk. There are banners after the jump.]]></description>
			<content:encoded><![CDATA[<p>Honda Power-Sports are coming to your town.<br />
Like a wrecking ball hungry for bricks.</p>
<p>OK, I&#8217;m a little sleepy, and a lot drunk.<br />
There are banners after the jump.</p>
<p><span id="more-4199"></span>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_3" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/06/BecomeADealer_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/06/BecomeADealer_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/14/amazing-honda-banners/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apsen Banners for NASCAR</title>
		<link>http://yo.drpunchman.com/2011/08/12/apsen-banners-for-nascar/</link>
		<comments>http://yo.drpunchman.com/2011/08/12/apsen-banners-for-nascar/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 04:39:35 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[Aspen]]></category>
		<category><![CDATA[dentures]]></category>
		<category><![CDATA[man love]]></category>
		<category><![CDATA[Rusty Wallace]]></category>
		<category><![CDATA[trumbone]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=4207</guid>
		<description><![CDATA[&#8230;and for you NASCAR fans: Rusty Wallace! I hope cars smashing into each other gives you an erection as violent as mine. Rusty Wallace&#8230; You are the albino ghost who drove off with my heart. I heart you, Rusty. I heart you hard.]]></description>
			<content:encoded><![CDATA[<p>&#8230;and for you NASCAR fans: Rusty Wallace!<br />
I hope cars smashing into each other gives you an erection as violent as mine.<br />
<span id="more-4207"></span>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_4" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/06/Shift_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/06/Shift_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br />

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_5" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/06/checkeredFlag_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/06/checkeredFlag_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</p>
<p>Rusty Wallace&#8230; You are the albino ghost who drove off with my heart.<br />
I heart you, Rusty. I heart you hard.</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/12/apsen-banners-for-nascar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspen Dental Banner Bonanza!</title>
		<link>http://yo.drpunchman.com/2011/08/10/aspen-dental-banner-bonanza/</link>
		<comments>http://yo.drpunchman.com/2011/08/10/aspen-dental-banner-bonanza/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 04:24:59 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Aspen]]></category>
		<category><![CDATA[banners]]></category>
		<category><![CDATA[dentures]]></category>
		<category><![CDATA[teeth]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=4192</guid>
		<description><![CDATA[Do you like dentures as much as I do? Then you will LOVE these banners! See how those words do magic to your face! They are totally 3D-ish. For more 3D action, try leaning into and away from the monitor really fast.]]></description>
			<content:encoded><![CDATA[<p>Do you like dentures as much as I do?<br />
Then you will LOVE these banners!<br />
<span id="more-4192"></span>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_6" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/06/nojudgement_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/06/nojudgement_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br />

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_7" width="300" height="250">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2011/06/excuses_300x250.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2011/06/excuses_300x250.swf" width="300" height="250">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br />
See how those words do magic to your face!<br />
They are totally 3D-ish.<br />
For more 3D action, try leaning into and away from the monitor really fast.</p>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/08/10/aspen-dental-banner-bonanza/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS2: Banner basics</title>
		<link>http://yo.drpunchman.com/2011/07/29/as2-banner-basics/</link>
		<comments>http://yo.drpunchman.com/2011/07/29/as2-banner-basics/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 22:29:10 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actinscript 2]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[banners]]></category>
		<category><![CDATA[CODE]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7412</guid>
		<description><![CDATA[At it again&#8230; I am constantly trying to improve AS2 banners&#8230; it is getting to be a lost art, as less and less people are using AS2 for anything. For me AS2 is still &#8220;food on the table&#8221;, so here it goes: com/BannerBasics.as com/Particle.as]]></description>
			<content:encoded><![CDATA[<p>At it again&#8230;<br />
I am constantly trying to improve AS2 banners&#8230; it is getting to be a lost art, as less and less people are using AS2 for anything. For me AS2 is still &#8220;food on the table&#8221;, so here it goes:</p>
<pre class="brush: as3; title: ; notranslate">
// load the banner code
#include &quot;com/BannerBasics.as&quot;

// load the particle code
#include &quot;com/Particle.as&quot;

/*
------------------------------------------------------------
//set outline examples:

_outlineColor = 0x000000;
_outlineWidth = 1;
------------------------------------------------------------
*/
_outlineColor = 0x000000;
_outlineWidth = 1;

/*
------------------------------------------------------------
	Here are some examples of how
	you can start/stop the effects
------------------------------------------------------------
// set your own variables:

setupParticle( minSpeed (seconds),
maxSpeed (seconds), spread, totalParticles,
speed, rotation, holder movieClip );

ex. setupParticle(2,4,50,200,150, 360, this );

// examples:
setTimeout( killParticle, 2000 ); // clears the scene
setTimeout( initParticle, 3000 ); // starts the animation
setTimeout( pauseParticle, 4000 ); // lets the ani finish
setTimeout( playParticle, 5000 ); // lets the timer start over

*/

setupParticle( 1, 3, 50, 800, 250, 360, holder_fx );
initParticle();
</pre>
<p><span id="more-7412"></span><br />
com/BannerBasics.as</p>
<pre class="brush: as3; title: ; notranslate">
/*
-------------------------------------
	AS2 Banner Basics function
	No, this isn't a class.
-------------------------------------
*/

/*
-------------------------------------------------
	TWEEN CLASSES
-------------------------------------------------
*/
import com.greensock.*;
import com.greensock.easing.*;

// ------------
stop();

/*
-------------------------------------------------
	OUTLINE
-------------------------------------------------
*/
// basic variables
var _sw:Number = Stage.width;	// Stage Width
var _sh:Number = Stage.height;	// Stage Height
var _swc:Number = _sw/2;		// Center Stage Width
var _shc:Number = _sh/2;		// Center Stage Height

// set outline
var _outlineColor:Number;
var _outlineWidth:Number;

// function to draw the outline
function outline() : Void
{
    var top:Number = 0.5;
    var w: Number = _sw - top;
    var h: Number = _sh - top;

    var btn:MovieClip = createEmptyMovieClip(&quot;outline&quot;, this.getNextHighestDepth());
    btn.lineStyle(_outlineWidth, _outlineColor, 100, true, &quot;none&quot;, &quot;normal&quot;, &quot;miter&quot;, 3);
	btn.beginFill(0x66FFFF, 0);
    btn.lineTo(w, top);
    btn.lineTo(w, h);
    btn.lineTo(top, h);
    btn.lineTo(top, top);
	btn.endFill();

	btn.onRollOver = button_over;
	btn.onRollOut = button_out;
	btn.onRelease = click_out;

}

// preloader ----------------------
this._visible = false;
onEnterFrame = function(){
	var percent_loaded = _root.getBytesLoaded()/_root.getBytesTotal();
	trace( percent_loaded + &quot;%&quot; );

	if (percent_loaded == 1)
	{
		delete onEnterFrame;
		init();
	}
}
// run the functions ---------------
function init() : Void
{

	if( !_outlineWidth ) _outlineWidth = 1;
	if( !_outlineColor ) _outlineColor = 0x000000;

	outline();

	this._visible = true;
}

// button animation
function button_over() : Void
{
	if( CTA ) CTA.gotoAndPlay(&quot;up&quot;);
}
function button_out() : Void
{
	if( CTA ) CTA.gotoAndPlay(&quot;dn&quot;);
}

function click_out() : Void
{
//	trace( &quot;clicking out&quot; );
	getURL( _level0.clickTag, &quot;_blank&quot; );
}

// timer
setTimeout( function()
{
	trace(&quot;[ 15 sec ]&quot;);
}, 14900 );
</pre>
<p>com/Particle.as</p>
<pre class="brush: as3; title: ; notranslate">
/*
-------------------------------------
	AS2 Particle function
	No, this isn't a class.
-------------------------------------

import com.greensock.*;
import com.greensock.easing.*;
*/

// Set variables
var pArr:Array = new Array();
var pNum:Number = 0;
var _genTimer:Number;

var _minSpeed:Number = 2;
var _maxSpeed:Number = 10;
var _spread:Number = 15;
var _totalParticles:Number = 800;
var _speed:Number = 200;

var _holder = this;

/*
------------------------------------------------------------
	Here are some examples of how
	you can start/stop the effects
------------------------------------------------------------

setupParticle(2,4,50,200,150,this);

setTimeout( killParticle, 2000 ); // clears the scene
setTimeout( initParticle, 3000 ); // starts the animation
setTimeout( pauseParticle, 4000 ); // lets the ani finish
setTimeout( playParticle, 5000 ); // lets the timer start over

*/

// only run this once.
function setupParticle( minSpeed, maxSpeed, spread, totalP, speed, maxrot, holder ) : Void
{
	// Create particle holder at next highest level
	_holder = holder;
	_holder.createEmptyMovieClip(&quot;ptcl_hldr&quot;, _holder.getNextHighestDepth());
	// reset the vars
	_minSpeed = minSpeed;
	_maxSpeed = maxSpeed;
	_spread = spread;
	_totalParticles = totalP;
	_speed = speed;
	_maxRotation = maxrot;

//	trace(&quot;[ setup particles ]&quot;);
}

function initParticle() : Void
{
	// get the timer ready
	playParticle();

	// because the timer doesn't start immediatly
	genParticle();

//	trace(&quot;[ init particles ]&quot;);
}

function playParticle() : Void
{
	// Make a particle speed set by _speed (generate speed)
	_genTimer = setInterval(genParticle, _speed);

//	trace(&quot;[ play particles ]&quot;);
}

function pauseParticle() : Void
{
	// kill the timer, kill the animation
	clearInterval(_genTimer);

//	trace(&quot;[ pause particles ]&quot;);
}

//Generate a particle
function genParticle():Void
{
    var xRan:Number = Math.floor(
        Math.random()*(1+_spread-(_spread*-1)))+(_spread*-1);
	var yRan:Number = Math.floor(
        Math.random()*(1+_spread-(_spread*-1)))+(_spread*-1);
	var aniSpeed:Number = Math.floor(
        Math.random()*(1+_maxSpeed-_minSpeed))+_minSpeed;
	var angle:Number = angleOf(
        emitter._x, emitter._y, destination._x, destination._y);

	var pmc = _holder.attachMovie( &quot;ptcl_fx&quot;, &quot;ptcl&quot; + pNum, _holder.getNextHighestDepth() );

	pmc.cacheAsBitmap = true;
	pmc.forceSmoothing = true;
	pmc._x = emitter._x;
	pmc._y = emitter._y;
	pmc._rotation = angle;
	pmc._xscale = 10;
	pmc._yscale = 10;

	new TweenNano( pmc, aniSpeed,
	{
        _alpha:0,
		_x:destination._x + xRan,
		_y:destination._y + yRan,
		_xscale:100,
		_yscale:100,
		_rotation: Math.random() * _maxRotation,
		ease:Circ.easeIn,
        onCompleteParams:[pmc] ,
        onComplete:deleteParticle
	});

	pNum++;
	pArr.push( pmc );

	if(pNum == _totalParticles){
		clearInterval(_genTimer);
	}

}

// Delete particle when it's finished
function deleteParticle( mc ) :Void
{
	mc.unloadMovie();

//	trace(&quot;[ del particles ]&quot;);
}

// Delete all particles NOW
function killParticle() : Void
{
	for ( i in  pArr )
	{
		pArr[i].unloadMovie();
	}
	// kill the timer as well
	clearInterval( _genTimer );

//	trace(&quot;[ kill particles ]&quot;);
}

// Works out the angle between two points
function angleOf(x1,y1,x2,y2) :Number
{
	var dx = x2-x1;
	var dy = y2-y1;
	var angle = Math.atan2(dy,dx);
	return Math.floor(toDegrees(angle));
}

// Converts radians to degrees
function toDegrees(radians) :Number
{
	var degrees = radians * 180/Math.PI
	return degrees;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/07/29/as2-banner-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebCam Control</title>
		<link>http://yo.drpunchman.com/2011/07/21/webcam-control/</link>
		<comments>http://yo.drpunchman.com/2011/07/21/webcam-control/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 21:46:59 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[web cam]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=7248</guid>
		<description><![CDATA[Just so I have it for later, I am posting the code here.  There really isn&#8217;t enough here for me to worry about posting a SWF or FLA.]]></description>
			<content:encoded><![CDATA[<p>Just so I have it for later,<br />
I am posting the code here.  There really isn&#8217;t enough here for me to worry about posting a SWF or FLA.</p>
<pre class="brush: as3; title: ; notranslate">
/*
	Specifies the maximum amount of bandwidth that the
	current outgoing video feed can use, in bytes per second.
	To specify that Flash Player video can use as much bandwidth as
	needed to maintain the value of quality , pass 0 for bandwidth .
	The default value is 16384.
*/
var bandwidth:int = 0;
/*
	this value is 0-100 with 1 being the lowest quality.
	Pass 0 if you want the quality to vary to keep better framerates
*/
var quality:int = 0; 

// add the camera
var web_cam:Camera = Camera.getCamera();
web_cam.setQuality(bandwidth, quality);

// setMode(videoWidth, videoHeight, video fps, favor area)
// I use a mask object... want to make sure this is a little bigger then the mask.
web_cam.setMode( msk.width + 4 ,msk.height + 4, 15, true);

// Now attach the webcam stream to a video object.
var web_vid:Video = new Video();
web_vid.attachCamera(web_cam);

// throw it onto the stage (well in the vid_holder MovieClip)
vid_holder.addChild(web_vid);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2011/07/21/webcam-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

