<?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>plasticular inscriptor &#187; actionscript</title>
	<atom:link href="http://www.plasticstare.com/plains/category/coding/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.plasticstare.com/plains</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:43 +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>Flash Text Metrics</title>
		<link>http://www.plasticstare.com/plains/2010/08/17/flash-text-metrics/</link>
		<comments>http://www.plasticstare.com/plains/2010/08/17/flash-text-metrics/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 23:57:21 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2010/08/17/flash-text-metrics/</guid>
		<description><![CDATA[via blog.six4rty.ch I like the article at http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/, mainly because of this graphic. I found it somewhere before long ago (maybe the same place) &#8212; it is a big help when dealing with customized text layout situations in flash where you have to do manual baseline aligment and such. Posted via email from micro-plains]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<div class="posterous_bookmarklet_entry"> <a href='http://posterous.com/getfile/files.posterous.com/plains/ljpuIsrJznGcsDckbFoCAoDzyGmgDwcCxqADhcgpxvuCgChszHglDvEnzIdm/media_httpblogsix4rty_xbzbq.jpg.scaled1000.jpg'><img src="http://posterous.com/getfile/files.posterous.com/plains/ljpuIsrJznGcsDckbFoCAoDzyGmgDwcCxqADhcgpxvuCgChszHglDvEnzIdm/media_httpblogsix4rty_xbzbq.jpg.scaled500.jpg" width="500" height="335"/></a>
<div class="posterous_quote_citation">via <a href="http://blog.six4rty.ch/wp-content/uploads/2010/07/text-metrics.jpg">blog.six4rty.ch</a></div>
<p>I like the article at <a href="http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/">http://blog.six4rty.ch/2010/07/31/as3-multiline-textfields-and-line-metrics/</a>, mainly because of this graphic. I found it somewhere before long ago (maybe the same place) &#8212; it is a big help when dealing with customized text layout situations in flash where you have to do manual baseline aligment and such.</p>
</div>
<p style="font-size: 10px;"> <a href="http://posterous.com">Posted via email</a>  from <a href="http://plains.posterous.com/flash-text-metrics">micro-plains</a> </p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2010/08/17/flash-text-metrics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix the Focus Rect for fl.controls.TextInput in AS3</title>
		<link>http://www.plasticstare.com/plains/2009/05/28/fix-the-focus-rect-for-flcontrolstextinput-in-as3/</link>
		<comments>http://www.plasticstare.com/plains/2009/05/28/fix-the-focus-rect-for-flcontrolstextinput-in-as3/#comments</comments>
		<pubDate>Thu, 28 May 2009 22:35:04 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash as3 component textinput]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=288</guid>
		<description><![CDATA[The AS3 components in CS4 allow for visually showing that the component is focused, using a code generated or libary asset sprite as the focusRect. This can be changed using the focusRect property or through the #setStyle method inherited by all UIComponent&#8217;s. The outlying size of the focusRect can also be altered by setting the [...]]]></description>
			<content:encoded><![CDATA[<p>The AS3 components in CS4 allow for visually showing that the component is focused, using a code generated or libary asset sprite as the focusRect. This can be changed using the focusRect property or through the #setStyle method inherited by all UIComponent's. The outlying size of the focusRect can also be altered by setting the focusRectPadding style, which designates the number of pixels outside the size of the component that the focusRect sits. Unfortunately, if you are using TextInput, and likely TextArea, setting this padding to 0 results in hiding the focusRect behind the component skin (the grey outline for the TextInput). This is a result of the fact that the UIComponent#drawFocus sets the childIndex of the focusRect sprite to 0, essentially placing it behind the TextInput border. I wanted to create a subclass of TextInput for which I didn't need to reset several defaults every time I used it, so I created the class below, which also fixes the 0 padding focusRect issue.<br />
<span id="more-288"></span></p>
<pre class="brush: as3; title: ; notranslate">
package {

	import fl.controls.TextInput;
	import fl.managers.IFocusManagerComponent;

	/**
	 * Extends the TextInput component in order to set the default width and
	 * height, and sets the focusRectPadding to 0 (so the focus rectangle lies
	 * directly on top of the grey text input border skin.
	 */
	public class TextInput2 extends TextInput implements IFocusManagerComponent {

		/**
		 * @constructor
		 */
		public function TextInput2() {
			super();
			textField.width = 1;
			textField.height = 1;
			width = 64;
			height = 18;
			setStyle(&quot;focusRectPadding&quot;, 0);
		}

		/**
		 * The UIComponent class, when the component is in focus, creates the
		 * uiFocusRect and sets it at childIndex 0. Unfortunately, the text input
		 * skin is then above the focus rect, and so the focus rect disappears
		 * when the focusRectPadding is 0. This calls the parent implementation,
		 * then ensures that the focus rect is visible by changing its
		 * child index.
		 */
		override public function drawFocus(draw:Boolean):void {
			super.drawFocus(draw);

			if (uiFocusRect != null) {
				setChildIndex(uiFocusRect, numChildren - 1);
			}
		}
	}
}
</pre>
<p>UPDATE: I updated the above script to set the size of the TextField in the TextInput component to be 1x1. This also fixes the problem that the TextField is created as 100x100 pixels when it is first created (as are all dynamically generated text fields). This matters if you wish to use any customized layout (such as the Yahoo astra layout managers), and don't want to have to call drawNow() or wait a frame to finalize layout settings in a UI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2009/05/28/fix-the-focus-rect-for-flcontrolstextinput-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Line-width on Shapes in Flash, and scale9Grid Results</title>
		<link>http://www.plasticstare.com/plains/2009/05/20/line-width-on-shapes-in-flash/</link>
		<comments>http://www.plasticstare.com/plains/2009/05/20/line-width-on-shapes-in-flash/#comments</comments>
		<pubDate>Wed, 20 May 2009 22:18:42 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[linewidth]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[scale9Grid]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=275</guid>
		<description><![CDATA[A quick note regarding something I've been meaning to post a short note about for a while, for those that might be running into problems resulting from shapes drawn in flash with an outline. I ran into this recently again, so I thought I'd post for any concerned parties out there. Regardless of whether or [...]]]></description>
			<content:encoded><![CDATA[<p>A quick note regarding something I've been meaning to post a short note about for a while, for those that might be running into problems resulting from shapes drawn in flash with an outline. I ran into this recently again, so I thought I'd post for any concerned parties out there.</p>
<p>Regardless of whether or not a shape, such as a rectangle, is drawn in Flash with a hairline border line, or a borderline of 1, the result on an unscaled shape is essentially the same. The crisp outline of the shape is drawn with a pixel width of 1. The downside of this occurs when trying to create pixel perfect UI's, and especially those using shapes with a scalenine grid assigned to them.<br />
<span id="more-275"></span><br />
Using the AS3 drawing API, you can create a rectangle that has a lineStyle with a width of 1, and some fill, which would look something like this:</p>
<pre class="brush: as3; light: true; title: ; notranslate">var sh:Shape = new Shape();
sh.graphics.lineStyle(1, 0xFF0000);
sh.graphics.beginFill(0xFF6600);
sh.graphics.drawRect(0, 0, 100, 100);
sh.graphics.endFill();
addChild(sh);
trace(&quot;Size: &quot; + sh.width + &quot; x &quot; + sh.height);</pre>
<p>The code above so draws an orange rectangle with a red border that is <em>201</em> pixels wide and <em>101</em> pixels tall. If you don't know why, the reason is because flash draws the line <em>on</em> the pixel width and height of the rectangle with a line size of 1. This makes your shape 201 x 101; thankfully, Flash <em>will</em> report the width and height correctly as 201 x 101.</p>
<p>This gets stickier if you have a shape that is used as a component skin, and has a scale9Grid applied to it. In this case you will likely be working with a component that you <em>expect</em> to take up 200x100 pixels on the stage when you tell it to be that size. However, if the skin used features "line" outlines at its borders, your component will get drawn on the stage with extra pixels. If you dig into the Flash component skins, you will notice that most of the skins use <em>fills</em> for any borders on the shapes (even 1 pixel wide borders) so that the scale9Grid enabled shapes will scale correctly to the pixel. That being said, the proper way to draw the simple skin shape in this case, programmatically, would be:</p>
<pre class="brush: as3; light: true; title: ; notranslate">
var sh2:Shape = new Shape();
sh2.graphics.beginFill(0xFF0000);
sh2.graphics.drawRect(0, 0, 200, 100);
sh2.graphics.beginFill(0xFF6600);
sh2.graphics.drawRect(1, 1, 198, 98);
sh2.graphics.endFill();
addChild(sh2);
trace(&quot;Size: &quot; + sh2.width + &quot; x &quot; + sh2.height);
</pre>
<p>Incidentally, this also often cleans up some anti-aliasing at the corners of rectangular shapes which I believe is cause by some weirdness in the way the "caps" are drawn on the shapes. (but don't quote me on that...)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2009/05/20/line-width-on-shapes-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3 ComboBox close error.</title>
		<link>http://www.plasticstare.com/plains/2009/04/13/as3-combobox-close-error/</link>
		<comments>http://www.plasticstare.com/plains/2009/04/13/as3-combobox-close-error/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 17:45:38 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[combobox]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=271</guid>
		<description><![CDATA[Just a quick note for those possibly searching for ComboBox AS3 and "Cannot access a property or method of a null object reference." When using the AS3 ComboBox, the above error will be thrown when the ComboBox loses focus, if the ComboBox is in its open state and it has lost reference to the stage. [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note for those possibly searching for ComboBox AS3 and "Cannot access a property or method of a null object reference." When using the AS3 ComboBox, the above error will be thrown when the ComboBox loses focus, if the ComboBox is in its open state and it has lost reference to the stage. In other words, if you have a UI pane that contains the ComboBox, and you are removing the pane, make sure to first call #close() on all instances of the ComboBox, then remove the container from its parent container. (This can be replicated by clicking open the ComboBox, then clicking on the stage.) Unfortunately, the isOpen property for the ComboBox is not publicly accessible, but the #close() method is a NOOP if it is already closed, so just making sure to close it is no big deal. I ran into this error because I was listening for a stage focus event which triggered the immediate removal of the container pane in question, but I didn't find any relevant references in a quick web search, so I thought I'd make a quick post with the solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2009/04/13/as3-combobox-close-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Liven up Livedocs: Search from Quicksilver</title>
		<link>http://www.plasticstare.com/plains/2009/04/01/liven-up-livedocs-search-from-quicksilver/</link>
		<comments>http://www.plasticstare.com/plains/2009/04/01/liven-up-livedocs-search-from-quicksilver/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 20:10:07 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[quicksilver]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[livedocs]]></category>
		<category><![CDATA[techtip]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=263</guid>
		<description><![CDATA[Several months ago I jumped back into AS3 development for flash and I once again, therefore, jumped back into using the actionscript livedocs. LiveDocs are great, but I've always found navigating to them to be a big chore, even from a bookmark in a browser. In addition, the search functionality for LiveDocs to often be [...]]]></description>
			<content:encoded><![CDATA[<p>Several months ago I jumped back into AS3 development for flash and I once again, therefore, jumped back into using the actionscript livedocs. LiveDocs are great, but I've always found navigating to them to be a big chore, even from a bookmark in a browser. In addition, the search functionality for LiveDocs to often be frustrating. The other day it occurred to me, however, that the same search capability used to trigger <a href="http://www.google.com/url?sa=U&amp;start=1&amp;q=http://yubnub.org/&amp;ei=SsbTSbeiMZ-WswOypJ2tCg&amp;sig2=xoz9DuLQzGYPXqMUyfD-9Q&amp;usg=AFQjCNHPiIwr8PXYpzOAd3YbVRqRtPbtuA">yubnub</a> commands from Quicksilver could be implemented to search LiveDocs as well. Check out this tutorial at <a href="http://www.lifeclever.com/quicksilver-yubnub-rapid-web-searches-and-more/">lifeclever</a> to find out how to access yubnub from Quicksilver. The same principle can be used for searching live docs (and for searching the adobe help docs for flash 10 player AS3. Instead of using using the search URL <code>"qss-http://www.yubnub.org/parser/parse?command=***", use the following query URLs in a </code><code>quicksilver </code><code>web search trigger:</code></p>
<p>Flash 9 LiveDocs:  <code>qss-http://www.google.com/search?&amp;btnI&amp;q=site%3Ahttp%3A%2F%2Flivedocs.adobe.com%2Fflash%2F9.0%2FActionScriptLangRefV3%2F+***</code></p>
<p>Flash 10 Help Docs:  <code>qss-http://www.google.com/search?&amp;btnI&amp;q=site%3Ahttp%3A%2F%2Fhelp.adobe.com%2Fen_US%2FAS3LCR%2FFlash_10.0%2F+***</code></p>
<p>Basically, since there is no convenient way I found to use the search mechanisms on the Adobe site, these queries are running a google lucky search on the wildcard applied search term, while restricting the search to the site pertinent to the docs of interest. Running the assigned key command will trigger the Quicksilver text entry box; simply enter the term, such as "vector" for Flash 10, and the google lucky search will be performed. Since the lucky search is restricted to the livedocs and the help docs, the first search result returned will be the frameless html page in the docs for the search term. When searching for the docs for a specific actionscript term, this cuts the search time for a term down to a couple of seconds, which is highly convenient...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2009/04/01/liven-up-livedocs-search-from-quicksilver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chumby Widget 002 &#8211; Japanese Alphabet!</title>
		<link>http://www.plasticstare.com/plains/2008/01/27/chumby-widget-002-japanese-alphabet/</link>
		<comments>http://www.plasticstare.com/plains/2008/01/27/chumby-widget-002-japanese-alphabet/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 11:09:24 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[chumby]]></category>
		<category><![CDATA[hiragana]]></category>
		<category><![CDATA[japanese]]></category>
		<category><![CDATA[katakana]]></category>
		<category><![CDATA[nihongo]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2008/01/27/chumby-widget-002-japanese-alphabet/</guid>
		<description><![CDATA[Just finished up version 1.0 of the Japanese Syllabary Flash Card for the Chumby. It was approved in its version 0.1 stage last week, but unfortunately, when you update a widget, it has to be approved again for public viewing. Perhaps after the big official Chumby launch there will be different tier developer permissions, some [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/intafon/2222156175/" title="20080126120743_w810i.jpg by ⌫ uɐλɹ, on Flickr"><img src="http://farm3.static.flickr.com/2181/2222156175_1df05c45d8_m.jpg" alt="20080126120743_w810i.jpg" align="left" height="180" width="240" /></a>Just finished up version 1.0 of the Japanese Syllabary Flash Card for the Chumby. It was approved in its version 0.1 stage last week, but unfortunately, when you update a widget, it has to be approved again for public viewing. Perhaps after the big official Chumby launch there will be different tier developer permissions, some of which would allow for updating already approved widgets without further approval. I guess we shall see about that. So, I expect this one to go public again on Monday. I'll post the link for the Chumby site page for it once it is up again. In the meantime, you can view a non-configurable version on my site at  <a href="http://www.plasticstare.com/nihongo/syllabaryflashcard.html" title="Syllabary Flash Card" target="_blank">http://www.plasticstare.com/nihongo/syllabaryflashcard.html.</a> The photo is of a slightly earlier version than the current one, but it looks pretty much the same. The Chumby widget allows you to view Hiragana or Katakana (or random), allows you to choose which of the Romaji and symbol to view first, and allows you choose which character sets you wish to view (and defaults to a,i,u,e,o,ka,ki,ku,ke,ko, and ga,gi,gu,ge,go).</p>
<p>Update: the chumby widget can be found at <a href="http://www.chumby.com/guide/widget/Japanese%20Syllabary%20Flash%20Card" title="japanese syllabary flash card" target="_blank">http://www.chumby.com/guide/widget/Japanese Syllabary Flash Card</a>. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/01/27/chumby-widget-002-japanese-alphabet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>As2Api and RubyScript2Exe (darwinized)</title>
		<link>http://www.plasticstare.com/plains/2006/09/05/as2api-and-rubyscript2exe-darwinized/</link>
		<comments>http://www.plasticstare.com/plains/2006/09/05/as2api-and-rubyscript2exe-darwinized/#comments</comments>
		<pubDate>Tue, 05 Sep 2006 21:55:05 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[downloadable]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/09/05/as2api-and-rubyscript2exe-darwinized/</guid>
		<description><![CDATA[I recently sat down and took a look at as2api, which seems to be the most recommended JavaDoc exporter for actionscript. Once I had everything figured out, it seems to work fine, and I'm sure there are some little nuggets that I haven't quite figured out yet, which I'm looking forward to figuring out. (read [...]]]></description>
			<content:encoded><![CDATA[<p>I recently sat down and took a look at <a href="http://www.badgers-in-foil.co.uk/projects/as2api/">as2api</a>, which seems to be the most recommended JavaDoc exporter for actionscript. Once I had everything figured out, it seems to work fine, and I'm sure there are some little nuggets that I haven't quite figured out yet, which I'm looking forward to figuring out. (read more for the skinny and darwin downloads)</p>
<p><span id="more-103"></span></p>
<p>However, for those of you out there in Mac OSX land, I wouldn't recommend downloading the current version listed on the site for OSX, entitled "as2api-allinone-osx-0.4.sit" in the downloads section. I think that it is missing files, or that it just doesn't work correctly at all. I would recommend instead downloading the first link for "as2api-0.4.tar". The downside of downloading this version is that there is no OSX command line executable in there, so you have to run the Ruby script "ruby as2api.rb <em>packages</em> --classpath <em>classpath</em>" which works just fine.</p>
<p>Honestly, I don't know enough about ANT scripts yet to know if you can run Ruby scripts from an ANT script target, so I used <a href="http://www.erikveen.dds.nl/rubyscript2exe/index.html">rubyscript2exe</a>, another handy little application to convert the Ruby scripts into a mac command line executable. (Incidentally, and to add a little geek comedy to this post, you have to install the Pascal compiler and compile a piece of the rubyscript2exe library in order to run it...so I had to compile one application in order to create another one...).</p>
<p>Anyway, I have included below 2 downloadables in this post. The first is the command line version of as2api that is compiled from the package that you can download as Ruby code from the as2api site. The down side is that you cannot tweek the css and html templates that are part of that code; the up side is that you can actually use it as a command line executable, which is entitled "as2api_darwin". You can used it exactly as you would the as2api.rb Ruby script.</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
Darwin Executable of As2Api (JavaDoc for Actionscript) (Sep. 5, 2006)<br />
Download (~4.5mB) :: <a href="http://www.plasticstare.com/plasticware/thirdparty/as2api-0.4.zip">as2api-0.4.zip</a></span></p>
<p>The second downloadable I have included here is the rubyscript2exe download, altered to include the eee_darwin file that I compiled from the pascal source on my mactel laptop in OSX 10.4.7, and repackaged using tar2rubyscript.rb, which was also necessary to get it running properly. I have also included the example hello world script "hello.rb" from the tutorial, which you can use to test the code and make a hello world exe.</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
RubyScript2Exe with eee_darwin for OSX environment (Sep. 5, 2006)<br />
Download (~1.1mB) :: <a href="http://www.plasticstare.com/plasticware/thirdparty/rubyscript2exe.zip.gz">rubyscript2exe.zip.gz</a></span></p>
<p>Both of these pieces of software are released by their proper creators under the GNU License, and I have included the source and license for each as well, as posted on their sites. Please download judiciously, the executable for as2api package is 4.5 mb.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/09/05/as2api-and-rubyscript2exe-darwinized/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Actionscript Interface Implementation Error</title>
		<link>http://www.plasticstare.com/plains/2006/08/30/actionscript-interface-implementation-error/</link>
		<comments>http://www.plasticstare.com/plains/2006/08/30/actionscript-interface-implementation-error/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 00:01:34 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/08/30/actionscript-interface-implementation-error/</guid>
		<description><![CDATA[Just to add this to the web search realm, a quick note on a fairly annoying discrepancy in the Flash IDE. When compiling flash movies that utilize interfaces, there is the possibility of getting the following error: The implementation of the interface method doesn't match its definition. Despite the fact that MTASC has no problem [...]]]></description>
			<content:encoded><![CDATA[<p>Just to add this to the web search realm, a quick note on a fairly annoying discrepancy in the Flash IDE. When compiling flash movies that utilize interfaces, there is the possibility of getting the following error:</p>
<pre>The implementation of the interface method doesn't match its definition.</pre>
<p> Despite the fact that MTASC has no problem with it.</p>
<p><span id="more-116"></span></p>
<p>*I believe* that it is acceptable according to ECMA script standards to define functions in interfaces by supplying the <em>types</em> of the parameters, rather than the names and types. Compare:</p>
<pre>public function moo(Object, String):Void;</pre>
<p>vs:</p>
<pre>public function moo(cow:Object, foo:String):Void;</pre>
<p>The former is handled fine by MTASC; however, when compiled in the Flash IDE, the error "The implementation of the interface method doesn't match its definition." is returned for every function defined in the interface that has input parameters. The solution is to define the methods is in the latter example; however, for the Flash IDE to compile without errors, not only do the parameter types have to match, but also the parameters names have to match.</p>
<p>Hopefully that will help someone searching for this error...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/08/30/actionscript-interface-implementation-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interfacing in Actionscript</title>
		<link>http://www.plasticstare.com/plains/2006/08/25/interfacing-in-actionscript/</link>
		<comments>http://www.plasticstare.com/plains/2006/08/25/interfacing-in-actionscript/#comments</comments>
		<pubDate>Sat, 26 Aug 2006 03:02:53 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/08/25/interfacing-in-actionscript/</guid>
		<description><![CDATA[It wasn't until recently that I actually had the occasion where it made/makes a good bit of sense to use interfaces in any of my flash projects. Part of the reason has to do with formerly lacking the time to actually put together projects the right way, under crazy timelines, and part of it has [...]]]></description>
			<content:encoded><![CDATA[<p>It wasn't until recently that I actually had the occasion where it made/makes a good bit of sense to use interfaces in any of my flash projects. Part of the reason has to do with formerly lacking the time to actually put together projects the right way, under crazy timelines, and part of it has to do with the fact that I'm working on something that needs to stick around for a bit and will possibly be augmented by persons other (and including) myself.</p>
<p>In most flash projects, interfaces are a bit convoluted and require thoughtfully building out to what amounts to an extra class. Most of the time in smaller projects, subclassing "default" classes pretty much gets the job done. To backtrack slightly for those unfamiliar with the term, an interface is an abstract type which is used to designate how classes can be accessed and manipulated. To use the terminology, an <em>interface</em> specifies the interface that must be <em>implemented</em> by a set of classes.</p>
<p><span id="more-114"></span></p>
<p><strong>Utilizing Interfaces</strong></p>
<p>Interfaces in actionscript are particularly useful when creating a set of classes that all have the same methods; the interface strictly defines the guidelines that must be followed when creating a new class of this type.</p>
<p>As an example, let us suppose that we are creating a set of shape classes; we will be creating a circle class and a square class. Let us suppose for now that the only method that we want to implement is the getArea() method. Here are our classes:</p>
<div class="igBar"><span id="lactionscript-15"><a href="#" onclick="javascript:showCodeTxt('actionscript-15'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-15">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Circle <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> __radius:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> __type:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"Circle"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">function</span> Circle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.__radius, <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript-16"><a href="#" onclick="javascript:showCodeTxt('actionscript-16'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-16">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Square <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> __side:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> __type:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"Square"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">function</span> Square<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">pow</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.__side, <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So, both <em>implement</em> the same methods here. We can define an interface for all new shapes that get created, which must all allow for the calculation of their area (note that by convention, interfaces usually begin with the letter "I"):</p>
<div class="igBar"><span id="lactionscript-17"><a href="#" onclick="javascript:showCodeTxt('actionscript-17'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-17">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">interface</span> IShape <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">function</span> getArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You must then go back and change your class definition line in each of the two classes to </p>
<div class="igBar"><span id="lactionscript-18"><a href="#" onclick="javascript:showCodeTxt('actionscript-18'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-18">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Circle <span style="color: #0066CC;">implements</span> IShape <span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
and</p>
<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showCodeTxt('actionscript-19'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Square <span style="color: #0066CC;">implements</span> IShape <span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The interface defines how we can interact with shapes. The big advantage of this when working on projects is that when using environments such as Eclipse with FDT, you can specify that something is an IShape without knowing what shape it is specifically, thereby allowing you to build more flexible projects. In addition, rather than the alternative, which would be to type them as <em>Object</em>, you have a way of typing them that works with syntax checking and code hinting, which saves you time in the long run.</p>
<p><strong>Combining Interfaces with Inheritance</strong></p>
<p>Another handy trick to help when coding is to combine the use of interfaces with inheritance. Let's suppose we want to create a Shape superclass as such:</p>
<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showCodeTxt('actionscript-20'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Shape <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #0066CC;">implements</span> IShape<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> __type:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"Shape"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">function</span> Shape<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">undefined</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setColor<span style="color: #66cc66;">&#40;</span>newColor:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; theColor = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Color</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; theColor.<span style="color: #0066CC;">setRGB</span><span style="color: #66cc66;">&#40;</span>newColor<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Shape of type: "</span> + <span style="color: #0066CC;">this</span>.__type<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So, our definitions would change as such:</p>
<div class="igBar"><span id="lactionscript-21"><a href="#" onclick="javascript:showCodeTxt('actionscript-21'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-21">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> Square <span style="color: #0066CC;">extends</span> Shape <span style="color: #0066CC;">implements</span> IShape <span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now we have a few added benefits. Our shapes are now subclassed as MovieClips and Shapes, which means that they can inherit methods from the Shape class. All of our shapes have a __type and all are now MovieClips, so all of them can inherit toString() and setColor().</p>
<p>The cool part about this is that in this case, we now can implement the IShape interface (remember, all classes that implement an interface are <em>required</em> to implement the designated methods) without declaring ones inherited from the superclass unless we choose to do so. This means that we don't have to add toString() and setColor() unless we want to override the ones in the superclass. This is really great when you have several private variables with getters and setters that you want required by the interface, but don't want to have to duplicate and comment in every single subclass.</p>
<p>Another advantage of using interfaces is that, unlike extending superclasses, classes can implement as many interfaces as you want. For example, you could have a set of Shapes that implement an IAnimation interface as well as the IShape interface. Other types of objects could also implement this same IAnimation interface, so you could call the method pulse(cycleDuration) the same way on both types of class, and your code hinting would tell you that the method pulse requires a number input. This is probably the biggest advantage -- being able to type an object as an interface when passing it to another object that wants to treat it as something that has the methods that the interface requires.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/08/25/interfacing-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate &#8211; Continue Block Comment</title>
		<link>http://www.plasticstare.com/plains/2006/08/09/textmate-continue-block-comment/</link>
		<comments>http://www.plasticstare.com/plains/2006/08/09/textmate-continue-block-comment/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 16:31:21 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=106</guid>
		<description><![CDATA[The current release of TextMate seems to be missing the capability to allow for the auto continuation of block comments when editing actionscript files. To fix this, you can add a new snippet to the actionscript bundle in the bundle editor. In TM, go to the menu Bundles/Bundle Editor and choose Edit Snippets... Open the [...]]]></description>
			<content:encoded><![CDATA[<p>The current release of TextMate seems to be missing the capability to allow for the auto continuation of block comments when editing actionscript files. To fix this, you can add a new snippet to the actionscript bundle in the bundle editor.</p>
<p><span id="more-106"></span></p>
<ol>
<li>In TM, go to the menu Bundles/Bundle Editor and choose Edit Snippets...</li>
<li>Open the ActionScript section on the left, and click the "+" button at the bottom left and choose to add a new snippet.</li>
<li>Name the new snippet, such as "Continue Block Comment".</li>
<li>In the text area where is says Syntax Summary, delete the contents, and paste in the following:
<pre>${TM_CURRENT_LINE/(.*\*\/$)|.*?(\/\*(?!.*\*\/)).*|.*/(?1:
:
(?2: )* )/}</pre>
</li>
<li>Now click the Activation menu below (says "Tab Trigger") and change it to Key Equivalent. Click the field next to it, and hit the <Return> key (or the <Enter> key if you prefer). The return key symbol should show up.</li>
<li>In the scope selector field, type
<pre>source.actionscript comment.block</pre>
<p> - this will set the snippet to just work inside actionscript block comments bounded by "/** */"</li>
</ol>
<p>You can now close the bundle editor, and while typing in block comments in actionscript files, the return key should drop you to the next line, preserve the indent, and type in an asterisk followed by a space.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/08/09/textmate-continue-block-comment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flickr.Contactr Pre-pre-alpha</title>
		<link>http://www.plasticstare.com/plains/2006/06/01/flickrcontactr-pre-pre-alpha/</link>
		<comments>http://www.plasticstare.com/plains/2006/06/01/flickrcontactr-pre-pre-alpha/#comments</comments>
		<pubDate>Thu, 01 Jun 2006 17:27:03 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[plasticware]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=83</guid>
		<description><![CDATA[FlickrContactr PRE-PRE-alpha Originally uploaded by intafon. Started working yesterday on my FlickrContactr application which can be found at my other domain, www.intafon.com. It's kind of fun to play with so I went ahead and made it public, although it is still pretty seriously in a pre-alpha state. I don't think it will blow up your [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px"><a title="photo sharing" href="http://www.flickr.com/photos/intafon/158238533/"><img src="http://static.flickr.com/52/158238533_12bd071304_m.jpg" /></a><br />
<a href="http://www.flickr.com/photos/intafon/158238533/">FlickrContactr PRE-PRE-alpha</a><br />
Originally uploaded by <a href="http://www.flickr.com/people/intafon/">intafon</a>.</div>
<p>Started working yesterday on my FlickrContactr application which can be found at my other domain, www.intafon.com. It's kind of fun to play with so I went ahead and made it public, although it is still pretty seriously in a pre-alpha state. I don't think it will blow up your computer, but I suppose there is the possibility that it could crash your browser. Anyhow, I'll be posting updates to it pretty frequently in the next week or so, until I get a good bit of the functionality that I want to put in there implemented. Right now, its just a fun way to quickly view your contacts (and their contacts, and theirs, etc.). See it here :: <a href="http://www.intafon.com/flickrcontactr/index.php">http://www.intafon.com/flickrcontactr/index.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/06/01/flickrcontactr-pre-pre-alpha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Syntax Coloring/ Drawing Class</title>
		<link>http://www.plasticstare.com/plains/2006/05/31/testing-syntax-coloring-drawing-class/</link>
		<comments>http://www.plasticstare.com/plains/2006/05/31/testing-syntax-coloring-drawing-class/#comments</comments>
		<pubDate>Wed, 31 May 2006 16:08:08 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[plasticware]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=82</guid>
		<description><![CDATA[The following is a drawing class that I've used for the past year or so. I'm kind of using this article to test out various ways of doing syntax coloring in this blog. I use MoveableType, and I'm currently looking for some plug-in that will allow me to automatically publish code in the blog and [...]]]></description>
			<content:encoded><![CDATA[<p>The following is a drawing class that I've used for the past year or so. I'm kind of using this article to test out various ways of doing syntax coloring in this blog. I use MoveableType, and I'm currently looking for some plug-in that will allow me to automatically publish code in the blog and have it look correct. Unfortunately, the only one I've found so far MTColorer, I wasn't able to get working. There are a few that my friend Mason and I have looked at for WordPress that work pretty well and (like many WordPress things) are easily configurable/hackable and free. The code that I've included below (as well as the other code so far in this blog) is colored using the Actionscript HIghlighter featured on <a href="http://www.shockwave-india.com/blog/services/as-highlight2/">Arul's Blog</a>, which allows you to paste in your code and hit a button to get the styled text. Arul's code does a great job, but you have to visit his site to style your code, and then also provide a download link to the text file of your code if you want to provide just a plain text version. But hey, it works. He notes on the site that there is the possibility of releasing the code once he cleans it up, so maybe there will be something one can post on their own site sometime soon.</p>
<p>As for the code below, it is a simple drawing class that allows you to easily draw a generic  box, a hairline box, and a filled rectangle. The main reason, however, that I created the class, is for those occasions where you may need a box that  is not filled and is not made up of flash lines. If you've used Flash enough, you know that if you draw a 3 pixel line box, the corners are often rounded looking, which doesn't fly unless that is what you want in your design. I have worked on several projects that were to use photos that needed a "frame" of a certain width. The drawing class drawFrame method basically draws 4 filled boxes to create a rectangular "frame" of a certain thickness, made entirely of "fill" rather than lines, so the corners are nice and sharp. Of the instances where I have used this class, I have used the drawFrame method 90% of the time. Enjoy.</p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showCodeTxt('actionscript-24'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * &nbsp;Drawing</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; @author - Ryan Todd</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; PlasticStare PlasticWare Codebase Project (PWCB)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; This code is part of the PlasticStare PlasticWare codebase project. This work is Copyright (c) 2005 Ryan Todd, all rights reserved.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; Prior permission of the author is required in order to redistribute the source code or algorithms in a commercial product in any </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; form -- original or derivative, in any programming language. The source code of the equations may be distributed as part of a </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; non-commercial product, provided that redistributions contain the copyright notice:</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; This Code is Copyright (c) 2005 Ryan Todd, all rights reserved.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; This work is subject to the terms in http://www.plasticstare.com/codebase_terms_of_use.html.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; AUTHOR :: Ryan Todd</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; AUTHOR SITE :: http://www.plasticstare.com/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; CREATED :: 2005/10/15</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; Drawing - this can be used to draw boxes and sometime in the future, other shapes</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&nbsp; Version :: v.1.0.5.20051015 for Actionscript 2.0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">*/</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">plasticstare</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Drawing</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Drawing<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// drawHairlineBox - draws a box at in the specified movieclip with the specified rect and color. the line</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// of the box is of hairline thickness</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> drawHairlineBox<span style="color: #66cc66;">&#40;</span>_mc:<span style="color: #0066CC;">MovieClip</span>,_color:<span style="color: #0066CC;">String</span>, _rectArray:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;color:#800000;">100</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Drawing.<span style="color: #006600;">drawBox</span><span style="color: #66cc66;">&#40;</span>_mc,_color, _rectArray<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// drawBox</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> drawBox<span style="color: #66cc66;">&#40;</span>_mc:<span style="color: #0066CC;">MovieClip</span>,_color:<span style="color: #0066CC;">String</span>, _rectArray:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>, _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// drawFilledBox</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> drawFilledBox<span style="color: #66cc66;">&#40;</span>_mc:<span style="color: #0066CC;">MovieClip</span>,_color:<span style="color: #0066CC;">String</span>,<span style="color: #0066CC;">_alpha</span>:<span style="color: #0066CC;">Number</span>,_rectArray:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,0x000000,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">beginFill</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #0066CC;">_alpha</span><span style="color: #66cc66;">&#41;</span>;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> _rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// drawFrame - essentially draws 4 boxes inside the specified rect of the color specified. these boxes</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// align along the inside of the top, bottom, left, and right of the rect and have the thickness (from the </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// rect border to the inner side of the box) specified</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> drawFrame<span style="color: #66cc66;">&#40;</span>_mc:<span style="color: #0066CC;">MovieClip</span>,_color:<span style="color: #0066CC;">String</span>, _rectArray:<span style="color: #0066CC;">Array</span>, _thickness<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> topb:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>+_thickness<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> botb:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span>-_thickness,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> lftb:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>+_thickness,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rgtb:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>-_thickness,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>,_rectArray<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>topb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,topb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Drawing.<span style="color: #006600;">drawBox</span><span style="color: #66cc66;">&#40;</span>_mc,_color, topb<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>botb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,botb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Drawing.<span style="color: #006600;">drawBox</span><span style="color: #66cc66;">&#40;</span>_mc,_color, botb<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>lftb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,lftb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Drawing.<span style="color: #006600;">drawBox</span><span style="color: #66cc66;">&#40;</span>_mc,_color, lftb<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span>rgtb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>,rgtb<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Drawing.<span style="color: #006600;">drawBox</span><span style="color: #66cc66;">&#40;</span>_mc,_color, rgtb<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _mc.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>_color<span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/05/31/testing-syntax-coloring-drawing-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hierarchical Menu Traversal for the Ppl</title>
		<link>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/</link>
		<comments>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/#comments</comments>
		<pubDate>Tue, 16 May 2006 00:05:15 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=78</guid>
		<description><![CDATA[Well, as it was the most productive part of my day today, I decided to go ahead and impart it to the web. I'm sure there are plenty of examples out there...but I might as well use it as a tutorial for those who might need it. Its not rocket-science, but for those who haven't [...]]]></description>
			<content:encoded><![CDATA[<p>Well, as it was the most productive part of my day today, I decided to go ahead and impart it to the web. I'm sure there are plenty of examples out there...but I might as well use it as a tutorial for those who might need it. Its not rocket-science, but for those who haven't really used it before, its kind of foreign.</p>
<p>[*NOTE: for the code below, you may want to click the permalink link at the bottom of the article - I haven't had time yet to set up my style sheets to have this look correct (i.e. some of the code is getting cut off on the right)...]</p>
<p>A co-worker had a friend who was looking to traverse hierarchical menu data and print it out in PHP and needed a quick thought-jump-start, so I gave him the following algorithm. The code I've included below is actually more in AS 2.0 format, but its just the syntax that differs from PHP.</p>
<p>The idea is that there is a heirarchical menu sort of like this:</p>
<p>Menu 1<br />
     Submenu 1<br />
          Subsubmenu 1<br />
          Subsubmenu 2<br />
     Submenu 2<br />
Menu 2<br />
Menu 3</p>
<p>...and this menu is currently bundled into an object array (for my example) that could have been parsed from XML. My example below gives each menu a "value," which is the text of the menu, such as "File" and also gives each menu a menu of its own, called here by name as "children."</p>
<p>An example of this menu in object syntax is as follows:</p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showCodeTxt('code-27'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu1"</span>,children:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Submenu1"</span>,children:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Subsubmenu1"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Subsubmenu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Submenu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu3"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically, the challenge for most people is just making that leap to get their head around how to traverse any number of submenu levels, since in the structure above, any submenu item can have its own submenus. The key to doing this lies in using a recursive function call (if you are unfamiliar you can just look up "recursion" on Google or Wikipedia). What the recursion allows you to do is define a situation in which the function calls itself with a new set of data, which is perfect for our hierarchical menu object.  Basically we want to print the menu values out, but if a menu has submenus, then we also want to print them out (and perhaps indent them). The AS 2.0 code for this is as follows:</p>
<div class="igBar"><span id="lactionscript-28"><a href="#" onclick="javascript:showCodeTxt('actionscript-28'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-28">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// printMenus :&nbsp; recursive function for printing the menu</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> printMenus <span style="color: #66cc66;">&#40;</span>clist, prefixString<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;color:#800000;">0</span>;nlength;n++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">print</span> <span style="color: #66cc66;">&#40;</span>prefixString + <span style="color: #ff0000;">"•"</span> + clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">children</span>.<span style="color: #006600;">length</span>&gt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printMenus<span style="color: #66cc66;">&#40;</span> clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">children</span>,<span style="color: #66cc66;">&#40;</span>prefixString + <span style="color: #ff0000;">"&nbsp; &nbsp; &nbsp;"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #808080; font-style: italic;">// end for loop</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// now print it</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">printMenus<span style="color: #66cc66;">&#40;</span>myMenuList, <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Please note that above I am using a hypothetical function called "print" to do the printing. In Flash, you could just use "trace" instead of "print" to see the results. Basically, the function is called, and the menu list (myMenuList here would be perhaps the object from above) and an initial indent of "" is passed in. As the menu is printed out, it checks to see if there are any menu children. If there are, the function calls itself again, this time with an augmented indention string. The function as it runs basically "drills down" the structure as far as it finds objects with children. I will say, however, that one needs to be careful how they use this in Flash, as I believe it still has a limit for the number of recursions that can be performed in a given period of time. Also, importantly, the variable "n" used as the index in the for loop must be scoped locally so that each time the function calls itself, a different local instance of a variable "n" gets used to do the loop. Hope this helps someone out there...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a True MovieClip Sub-Class</title>
		<link>http://www.plasticstare.com/plains/2005/12/21/creating-a-true-movieclip-sub-class/</link>
		<comments>http://www.plasticstare.com/plains/2005/12/21/creating-a-true-movieclip-sub-class/#comments</comments>
		<pubDate>Thu, 22 Dec 2005 05:08:04 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=64</guid>
		<description><![CDATA[My friend Alan and I had talked about this about 6 months ago. Suppose that you want to have an AS 2.0 Class that extends MovieClip, and you would like to "instantiate" as a movieclip in some location in your flash movie. It would be great to be able to call that class in the [...]]]></description>
			<content:encoded><![CDATA[<p>My friend Alan and I had talked about this about 6 months ago. Suppose that you want to have an AS 2.0 Class that extends MovieClip, and you would like to "instantiate" as a movieclip in some location in your flash movie. It would be great to be able to call that class in the same way that you can call MovieClip.createEmptyMovieClip(), and have a new movieclip instance that is in fact, a class that extends MovieClip.</p>
<p>Originally, the way that I had been doing this was to first create a class that extends MovieClip such as this ::</p>
<div class="igBar"><span id="lactionscript-33"><a href="#" onclick="javascript:showCodeTxt('actionscript-33'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-33">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">plasticstare</span>.<span style="color: #006600;">SpaceInvader</span> <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> SpaceInvader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"All your base..."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Then, I would create an empty movieclip symbol in the library of my .fla file, and give it a linkage id, and then in the linkage associate it with the AS 2.0 class of my choosing, or in this case, com.plasticstare.SpaceInvader.</p>
<p>There are a few problems with this beyond the fact that it seems a bit laborious to have to do this. When compiling code in MTASC, for example, you have to create a special little class to make sure that any .swfs that you are publishing as shared libraries actually get the newly compiled code and make a reference to it in your .fla files (or there is probably some other way to do this as well). Otherwise, if you make a change to your class for that linked symbol, you have to publish back out of the Flash IDE again. (And if you have a bunch of them, its a real pain.)</p>
<p>I stumbled upon another way of doing this today when checking out something else in the Flash LiveDocs. Someone had contributed the code below in its original form, and I've since made a couple of tweeks - one to fix a major flaw. </p>
<div class="igBar"><span id="lactionscript-34"><a href="#" onclick="javascript:showCodeTxt('actionscript-34'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-34">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> createExtendedMovieClip<span style="color: #66cc66;">&#40;</span>_constructor:<span style="color: #000000; font-weight: bold;">Function</span>, <span style="color: #0066CC;">_parent</span>:<span style="color: #0066CC;">MovieClip</span>, _depth:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0066CC;">_parent</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">_parent</span> = <span style="color: #0066CC;">_root</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!_depth<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _depth = <span style="color: #0066CC;">_parent</span>.<span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> mc:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #0066CC;">_parent</span>.<span style="color: #0066CC;">createEmptyMovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"clip_"</span>+_depth, _depth<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> _constructor<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &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: #b1b100;">in</span> obj<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mc<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = obj<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mc.<span style="color: #0066CC;">constructor</span> = _constructor;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mc.<span style="color: #0066CC;">__proto__</span> = obj.<span style="color: #0066CC;">__proto__</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> mc;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The idea would be to use this in your Main.as class or some utility class -- some class that you can reach universally. So, supposed that I have it in my Main singleton class. I would call the function this way
<pre>Main.getInstance().createExtendedMovieClip(SpaceInvader,_root);</pre>
<p> in order to create a new SpaceInvader clip in the _root. _constructor is simply the name of the class that you want to instantiate, and _parent and _depth are the clip you want it to reside in and at what depth. (the latter 2 parameters as you see are optional) Using this code, you can just create any new Class that extends MovieClip and instantiate it as a MovieClip instance on the stage on the fly, without creating any special linked symbols in the library.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2005/12/21/creating-a-true-movieclip-sub-class/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AS 1.0 MovieClip Extensions</title>
		<link>http://www.plasticstare.com/plains/2005/03/18/as-10-movieclip-extensions/</link>
		<comments>http://www.plasticstare.com/plains/2005/03/18/as-10-movieclip-extensions/#comments</comments>
		<pubDate>Sat, 19 Mar 2005 05:48:59 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[plasticware]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=33</guid>
		<description><![CDATA[I decided to re-release this list of prototype functions for actionscript 1.0 that augment the feature set of the MovieClip class. To use, simply add #include "as/MovieClipExtensions.as" (if you are keeping the ".as' files in a directory called "as") to the actionscript on frame 1 of your movie. They are a bit rough and not [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to re-release this list of prototype functions for actionscript 1.0 that augment the feature set of the MovieClip class. To use, simply add #include "as/MovieClipExtensions.as" (if you are keeping the ".as' files in a directory called "as") to the actionscript on frame 1 of your movie. They are a bit rough and not so commented, but they work none-the-less. I have since replaced/updated them with newer AS 2.0 classes and methods. Notable methods included are ::</p>
<ul>
<li>MovieClip.prototype.setPos :: handy for setting the position to an x,y coordinate</li>
<li>MovieClip.prototype.hideMe</li>
<li>MovieClip.prototype.showMe</li>
<li>MovieClip.prototype.loadWithFade :: for loading jpgs and fading them in</li>
<li>MovieClip.prototype.crossFadeTo :: for crossfading clips</li>
<li>MovieClip.prototype.roundCoords :: for use with pixel fonts - rounds to nearest integer coords</li>
<li>MovieClip.prototype.linearAnimate :: for doing linear animations of clip properties</li>
</ul>
<p>Version 1.5</p>
<p>Download :: <a href="http://www.plasticstare.com/plasticware/actionscript/as1/movieClipExtensions.zip"> movieClipExtensions.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2005/03/18/as-10-movieclip-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

