<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Artists, Animators and ActionScript 3.0</title>
	<atom:link href="http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/</link>
	<description>OOP Techniques for Flash and Flex Developers</description>
	<lastBuildDate>Mon, 26 Jul 2010 13:40:37 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3736</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Sun, 27 Dec 2009 10:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3736</guid>
		<description>Hi Curro,

It seems to work fine for me. I made a couple of little changes (changed &quot;txt&quot; for &quot;text&quot; so that you wouldn&#039;t use a reserved work and swapped Sprite for MovieClip since you didn&#039;t use any of the MovieClip methods). Here&#039;s what I got:

&lt;img src=&quot;http://www.as3dp.com/wp-content/uploads/2009/12/button.png&quot; alt=&quot;button&quot; title=&quot;button&quot; width=&quot;217&quot; height=&quot;59&quot; class=&quot;alignnone size-full wp-image-2314&quot; /&gt;

Here&#039;s the Client code I used:

&lt;pre lang=&quot;actionscript&quot;&gt;
package 
{
	import flash.display.Sprite;

	public class Client extends Sprite
	{
		private var tBtn:Sprite=new TextButton(&quot;AS3 Design Patterns&quot;,0xcc0000);

		public function Client()
		{
			tBtn.x=100,tBtn.y=100;
			addChild(tBtn);
		}
	}
}
&lt;/pre&gt;

It looks like a reusable hunk of code to me, and with just a tweak or two, it programs to the interface (Sprite) and not the implementation (TextButton).

Thanks,
Bill
</description>
		<content:encoded><![CDATA[<p>Hi Curro,</p>
<p>It seems to work fine for me. I made a couple of little changes (changed &#8220;txt&#8221; for &#8220;text&#8221; so that you wouldn&#8217;t use a reserved work and swapped Sprite for MovieClip since you didn&#8217;t use any of the MovieClip methods). Here&#8217;s what I got:</p>
<p><img src="http://www.as3dp.com/wp-content/uploads/2009/12/button.png" alt="button" title="button" width="217" height="59" class="alignnone size-full wp-image-2314" /></p>
<p>Here&#8217;s the Client code I used:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1380code1'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13801"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p1380code1"><pre class="actionscript" style="font-family:monospace;">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Client <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> tBtn:Sprite=<span style="color: #000000; font-weight: bold;">new</span> TextButton<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;AS3 Design Patterns&quot;</span>,0xcc0000<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Client<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			tBtn.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;">100</span>,tBtn.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;">100</span>;
			addChild<span style="color: #66cc66;">&#40;</span>tBtn<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>It looks like a reusable hunk of code to me, and with just a tweak or two, it programs to the interface (Sprite) and not the implementation (TextButton).</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Curro</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3735</link>
		<dc:creator>Curro</dc:creator>
		<pubDate>Sun, 27 Dec 2009 10:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3735</guid>
		<description>Hi everybody,
Sorry for my last post. Silly me! I forgot this is html and not flash so my TextButton class is useless here.
I also have forgotten how to insert code in the blog.

Beg your pardon again

Curro</description>
		<content:encoded><![CDATA[<p>Hi everybody,<br />
Sorry for my last post. Silly me! I forgot this is html and not flash so my TextButton class is useless here.<br />
I also have forgotten how to insert code in the blog.</p>
<p>Beg your pardon again</p>
<p>Curro</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Curro</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3734</link>
		<dc:creator>Curro</dc:creator>
		<pubDate>Sun, 27 Dec 2009 10:06:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3734</guid>
		<description>Hi Bill Chandima and Barbara,
Sorry for poking my nose in but I couldn&#039;t resist the temptation to show off my programming skills and thanking you for all you are giving us.
Here is a text button class which at least adds some movement. It is not very oop and it doesn&#039;t use any design pattern. It is also hard wired (you can&#039;t choose the text color, for example, although that is easy to change)
&lt;pre lang=&quot;actionscript&quot;&gt;
package 
{
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.filters.*;

	public class TextButton extends Sprite
	{
		public var field:TextField;
		private var bgColor:uint;

		public function TextButton(txt:String, bgColor:uint)
		{
			this.bgColor=bgColor;
			var textFormat:TextFormat = new TextFormat();
			textFormat.font=&quot;Arial&quot;;
			textFormat.size=18;
			textFormat.color=0xFFFFFF;

			field = new TextField();
			field.text=txt;
			field.setTextFormat(textFormat);
			field.autoSize=TextFieldAutoSize.LEFT;
			field.x=this.x+10-field.width/2;
			field.y=this.y-field.height/2;

			graphics.beginFill(bgColor);
			graphics.drawRoundRect(- (field.width/2),-field.height/2,field.width + 20 ,field.height + 2,12);
			graphics.endFill();

			addChildAt(field,0);
			var theMask :Sprite = new Sprite();
			theMask.graphics.beginFill(0x3399ff);
			theMask.graphics.drawRoundRect(- (field.width/2),-field.height/2,field.width + 20 ,field.height + 2,12);
			theMask.graphics.endFill();
			theMask.alpha=0;
			addChild(theMask);

			this.buttonMode=true;
			var bevelFilter:BevelFilter = new BevelFilter();
			bevelFilter.shadowAlpha=0.5;
			bevelFilter.distance=2;
			this.filters = [bevelFilter, new DropShadowFilter()];
			this.addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
			this.addEventListener(MouseEvent.MOUSE_UP, upHandler);
		}

		private function downHandler(event:MouseEvent)
		{
			var myFilter:DropShadowFilter = new DropShadowFilter();
			myFilter.inner=true;
			myFilter.distance=1.5;
			myFilter.blurX=2;
			myFilter.blurY=2;

			var bevelFilter:BevelFilter = new BevelFilter();
			bevelFilter.shadowAlpha=0.5;
			bevelFilter.distance=2;

			this.filters=[myFilter];
			field.x-=1;
			field.y-=1;
		}

		private function upHandler(event:MouseEvent)
		{
			var bevelFilter:BevelFilter = new BevelFilter();
			bevelFilter.shadowAlpha=0.5;
			bevelFilter.distance=2;
			this.filters = [bevelFilter, new DropShadowFilter()];
			field.x+=1;
			field.y+=1;
		}
	}
}
&lt;/pre&gt;



</description>
		<content:encoded><![CDATA[<p>Hi Bill Chandima and Barbara,<br />
Sorry for poking my nose in but I couldn&#8217;t resist the temptation to show off my programming skills and thanking you for all you are giving us.<br />
Here is a text button class which at least adds some movement. It is not very oop and it doesn&#8217;t use any design pattern. It is also hard wired (you can&#8217;t choose the text color, for example, although that is easy to change)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1380code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13802"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
</pre></td><td class="code" id="p1380code2"><pre class="actionscript" style="font-family:monospace;">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextFormat</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextFieldAutoSize</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TextButton <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> field:<span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> bgColor:uint;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TextButton<span style="color: #66cc66;">&#40;</span>txt:<span style="color: #0066CC;">String</span>, bgColor:uint<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">bgColor</span>=bgColor;
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">textFormat</span>:<span style="color: #0066CC;">TextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">textFormat</span>.<span style="color: #0066CC;">font</span>=<span style="color: #ff0000;">&quot;Arial&quot;</span>;
			<span style="color: #0066CC;">textFormat</span>.<span style="color: #0066CC;">size</span>=<span style="color: #cc66cc;">18</span>;
			<span style="color: #0066CC;">textFormat</span>.<span style="color: #0066CC;">color</span>=0xFFFFFF;
&nbsp;
			field = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			field.<span style="color: #0066CC;">text</span>=txt;
			field.<span style="color: #0066CC;">setTextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">textFormat</span><span style="color: #66cc66;">&#41;</span>;
			field.<span style="color: #0066CC;">autoSize</span>=TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;
			field.<span style="color: #006600;">x</span>=<span style="color: #0066CC;">this</span>.<span style="color: #006600;">x</span>+<span style="color: #cc66cc;">10</span>-field.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
			field.<span style="color: #006600;">y</span>=<span style="color: #0066CC;">this</span>.<span style="color: #006600;">y</span>-field.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
&nbsp;
			graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>bgColor<span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #006600;">drawRoundRect</span><span style="color: #66cc66;">&#40;</span>- <span style="color: #66cc66;">&#40;</span>field.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>,-field.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>,field.<span style="color: #0066CC;">width</span> + <span style="color: #cc66cc;">20</span> ,field.<span style="color: #0066CC;">height</span> + <span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			addChildAt<span style="color: #66cc66;">&#40;</span>field,<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> theMask :Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			theMask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x3399ff<span style="color: #66cc66;">&#41;</span>;
			theMask.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRoundRect</span><span style="color: #66cc66;">&#40;</span>- <span style="color: #66cc66;">&#40;</span>field.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>,-field.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>,field.<span style="color: #0066CC;">width</span> + <span style="color: #cc66cc;">20</span> ,field.<span style="color: #0066CC;">height</span> + <span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;
			theMask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			theMask.<span style="color: #006600;">alpha</span>=<span style="color: #cc66cc;">0</span>;
			addChild<span style="color: #66cc66;">&#40;</span>theMask<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">buttonMode</span>=<span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #000000; font-weight: bold;">var</span> bevelFilter:BevelFilter = <span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			bevelFilter.<span style="color: #006600;">shadowAlpha</span>=<span style="color: #cc66cc;">0.5</span>;
			bevelFilter.<span style="color: #006600;">distance</span>=<span style="color: #cc66cc;">2</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span>bevelFilter, <span style="color: #000000; font-weight: bold;">new</span> DropShadowFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, downHandler<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, upHandler<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> myFilter:DropShadowFilter = <span style="color: #000000; font-weight: bold;">new</span> DropShadowFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			myFilter.<span style="color: #006600;">inner</span>=<span style="color: #000000; font-weight: bold;">true</span>;
			myFilter.<span style="color: #006600;">distance</span>=<span style="color: #cc66cc;">1.5</span>;
			myFilter.<span style="color: #006600;">blurX</span>=<span style="color: #cc66cc;">2</span>;
			myFilter.<span style="color: #006600;">blurY</span>=<span style="color: #cc66cc;">2</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> bevelFilter:BevelFilter = <span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			bevelFilter.<span style="color: #006600;">shadowAlpha</span>=<span style="color: #cc66cc;">0.5</span>;
			bevelFilter.<span style="color: #006600;">distance</span>=<span style="color: #cc66cc;">2</span>;
&nbsp;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">filters</span>=<span style="color: #66cc66;">&#91;</span>myFilter<span style="color: #66cc66;">&#93;</span>;
			field.<span style="color: #006600;">x</span>-=<span style="color: #cc66cc;">1</span>;
			field.<span style="color: #006600;">y</span>-=<span style="color: #cc66cc;">1</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> upHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> bevelFilter:BevelFilter = <span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			bevelFilter.<span style="color: #006600;">shadowAlpha</span>=<span style="color: #cc66cc;">0.5</span>;
			bevelFilter.<span style="color: #006600;">distance</span>=<span style="color: #cc66cc;">2</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span>bevelFilter, <span style="color: #000000; font-weight: bold;">new</span> DropShadowFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
			field.<span style="color: #006600;">x</span>+=<span style="color: #cc66cc;">1</span>;
			field.<span style="color: #006600;">y</span>+=<span style="color: #cc66cc;">1</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3580</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Fri, 04 Dec 2009 19:22:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3580</guid>
		<description>Hi Barbara,

My button is based on my artistic skills--in other words, zilch! Any creative idea you have for a button would be most welcomed.

Thanks,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Barbara,</p>
<p>My button is based on my artistic skills&#8211;in other words, zilch! Any creative idea you have for a button would be most welcomed.</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3578</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Fri, 04 Dec 2009 16:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3578</guid>
		<description>Hi Bill,

Ha Ha!  Actually, it&#039;s more like not hitting your head against a brick wall -- feels so good when you stop!

Would you like something like your existing button only &quot;punched up?&quot; -- more 3D looking for example, or something completely different?  Give me a visual direction and I&#039;ll be glad to oblige.

Barbara</description>
		<content:encoded><![CDATA[<p>Hi Bill,</p>
<p>Ha Ha!  Actually, it&#8217;s more like not hitting your head against a brick wall &#8212; feels so good when you stop!</p>
<p>Would you like something like your existing button only &#8220;punched up?&#8221; &#8212; more 3D looking for example, or something completely different?  Give me a visual direction and I&#8217;ll be glad to oblige.</p>
<p>Barbara</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3553</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Thu, 03 Dec 2009 10:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3553</guid>
		<description>Hi Barbara!

Glad to hear from you. When you solve your own programming problem is that the same as &lt;em&gt;recursion&lt;/em&gt;? Yuk, yuk.

Thanks for the button offer, and if you&#039;re still game, I could use something to replace the ugly Play button I made all by myself!

Kindest regards,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Barbara!</p>
<p>Glad to hear from you. When you solve your own programming problem is that the same as <em>recursion</em>? Yuk, yuk.</p>
<p>Thanks for the button offer, and if you&#8217;re still game, I could use something to replace the ugly Play button I made all by myself!</p>
<p>Kindest regards,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3538</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Wed, 02 Dec 2009 16:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3538</guid>
		<description>Hi Bill and Chandima,

Never mind, I figured it out :-)  If you are using movie clips from the library and you move their corresponding classes to a to a folder, you have to put the path to the folder in the symbol properties in the class box!  So obvious, yet I had never run across this problem before.  I tried dot notation and it worked!  

Barbara

P.S.  I&#039;ll still make you a button or an icon if you want -- I&#039;m sure to panic again at some future time :-)</description>
		<content:encoded><![CDATA[<p>Hi Bill and Chandima,</p>
<p>Never mind, I figured it out :-)  If you are using movie clips from the library and you move their corresponding classes to a to a folder, you have to put the path to the folder in the symbol properties in the class box!  So obvious, yet I had never run across this problem before.  I tried dot notation and it worked!  </p>
<p>Barbara</p>
<p>P.S.  I&#8217;ll still make you a button or an icon if you want &#8212; I&#8217;m sure to panic again at some future time :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3519</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Tue, 01 Dec 2009 22:13:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3519</guid>
		<description>Hi Bill and Chandima,

If you can solve this one for me, just describe a piece of artwork and I’ll do it for you (if within my powers).  You will have earned it.  Did you ever hear the expression “pride goeth before a fall?”  I thought I had written the ultimate, wonderful, complete, working pattern design for my story project – and in a way, I have.  Then I tried to divide it up into packages… Oh woe!

Background:  commandStory is based on the command pattern, except instead of making it possible to repeat an action (such as incrementing a counter by pressing a button), commandStory makes it so one action triggers another in order from the beginning of the story to the end.  The idea was to make it possible to encapsulate each action (I called them pages) in its own command/receiver pair and then to have a number of these pages encapsulated in a chapter.  I wanted separate chapters so I could clean up after each chapter and also possibly implement chapter buttons for the user.  The invoker class does most of the work.  Instead of having just an execute() function (onBeginPageEvent()), it also has a setup() function (onTurnPageEvent()), that sets up each action via its command/receiver pair and then routes things back to the invoker which then sends out each execute() command to the same command/receiver pair.

I actually accomplished most of this.  The demo starts with a chapter 1 button you press, and a red circle appears.  Click on the red circle and it moves along the stage and triggers a scene change.  You hear whistling.  Then a bird head appears in the tree.  Click on the bird head and the whole bird pops out of the tree.  Drag the bird and he flaps his wings.  If you drag him near the left border of the stage, a fly appears.  When you touch the fly with the bird’s mouth, the fly disappears and the bird smiles.  A few seconds later, a cloud appears.  If you touch the cloud to the bird’s body, it registers a hit and a few seconds later you’re in chapter 2 – more objects moving across the stage.  I did all this to test and see if I could encapsulate each action in a command/receiver pair – sounds, dragging, hits, etc – which I could.

So what is the problem?  This story is going to have many chapters with many pages each, and I assumed it would be easy to put each chapter and possibly each page in its own package.  I tried very many things, but I can’t get past an initial road block:  If I put Chap_01.as in its own package, chapter_01, and label it correctly as such and put an import statement in TableOfContents.as (import chapter_01.*;), the methods in Chap_01 won’t run.  I get an error message:  TypeError: Error #1006: run is not a function.  (“Run” is the name of the method I am trying to run in Chap_01.)  I can run a trace statement from within TableOfContents.as such as trace(chap_01) and it works, but the methods of Chap_01 are apparently not available for some reason.  Any help you can give me will be greatly appreciated and if you want a button or an icon or even a banner and I can provide it, just name it.  Here’s the link.

http://www.bitsong.com/forPosting/packageProblem/packageProblem.html

Barbara</description>
		<content:encoded><![CDATA[<p>Hi Bill and Chandima,</p>
<p>If you can solve this one for me, just describe a piece of artwork and I’ll do it for you (if within my powers).  You will have earned it.  Did you ever hear the expression “pride goeth before a fall?”  I thought I had written the ultimate, wonderful, complete, working pattern design for my story project – and in a way, I have.  Then I tried to divide it up into packages… Oh woe!</p>
<p>Background:  commandStory is based on the command pattern, except instead of making it possible to repeat an action (such as incrementing a counter by pressing a button), commandStory makes it so one action triggers another in order from the beginning of the story to the end.  The idea was to make it possible to encapsulate each action (I called them pages) in its own command/receiver pair and then to have a number of these pages encapsulated in a chapter.  I wanted separate chapters so I could clean up after each chapter and also possibly implement chapter buttons for the user.  The invoker class does most of the work.  Instead of having just an execute() function (onBeginPageEvent()), it also has a setup() function (onTurnPageEvent()), that sets up each action via its command/receiver pair and then routes things back to the invoker which then sends out each execute() command to the same command/receiver pair.</p>
<p>I actually accomplished most of this.  The demo starts with a chapter 1 button you press, and a red circle appears.  Click on the red circle and it moves along the stage and triggers a scene change.  You hear whistling.  Then a bird head appears in the tree.  Click on the bird head and the whole bird pops out of the tree.  Drag the bird and he flaps his wings.  If you drag him near the left border of the stage, a fly appears.  When you touch the fly with the bird’s mouth, the fly disappears and the bird smiles.  A few seconds later, a cloud appears.  If you touch the cloud to the bird’s body, it registers a hit and a few seconds later you’re in chapter 2 – more objects moving across the stage.  I did all this to test and see if I could encapsulate each action in a command/receiver pair – sounds, dragging, hits, etc – which I could.</p>
<p>So what is the problem?  This story is going to have many chapters with many pages each, and I assumed it would be easy to put each chapter and possibly each page in its own package.  I tried very many things, but I can’t get past an initial road block:  If I put Chap_01.as in its own package, chapter_01, and label it correctly as such and put an import statement in TableOfContents.as (import chapter_01.*;), the methods in Chap_01 won’t run.  I get an error message:  TypeError: Error #1006: run is not a function.  (“Run” is the name of the method I am trying to run in Chap_01.)  I can run a trace statement from within TableOfContents.as such as trace(chap_01) and it works, but the methods of Chap_01 are apparently not available for some reason.  Any help you can give me will be greatly appreciated and if you want a button or an icon or even a banner and I can provide it, just name it.  Here’s the link.</p>
<p><a href="http://www.bitsong.com/forPosting/packageProblem/packageProblem.html" rel="nofollow">http://www.bitsong.com/forPosting/packageProblem/packageProblem.html</a></p>
<p>Barbara</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3185</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Wed, 21 Oct 2009 21:05:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3185</guid>
		<description>Wow, Thank you Chandima, that works very well. I think I can go ahead with my project now.  The solution seems so simple when you hand it to me on a platter.  I keep thinking &quot;why didn&#039;t I try that?&quot;  But that&#039;s because you wrote the book and I didn&#039;t.  Thanks again :-)

Barbara</description>
		<content:encoded><![CDATA[<p>Wow, Thank you Chandima, that works very well. I think I can go ahead with my project now.  The solution seems so simple when you hand it to me on a platter.  I keep thinking &#8220;why didn&#8217;t I try that?&#8221;  But that&#8217;s because you wrote the book and I didn&#8217;t.  Thanks again :-)</p>
<p>Barbara</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandima Cumaranatunge</title>
		<link>http://www.as3dp.com/2009/08/25/artists-animators-and-actionscript-30/comment-page-1/#comment-3184</link>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
		<pubDate>Wed, 21 Oct 2009 19:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1380#comment-3184</guid>
		<description>Hi Barbara,

Executing commands generally result in some well-known behavior (not behavior that varies). So, it is a good idea to have multiple commands to move the square/circle by different amounts ( e.g. &lt;code&gt;MoveBall5Command&lt;/code&gt;, &lt;code&gt;MoveBall10Command&lt;/code&gt; etc. etc.)

However, you don&#039;t need multiple receivers. The command &quot;knows&quot; the receiver. So, you can call the &lt;code&gt;setSizeOfStep&lt;/code&gt; method before &lt;code&gt;moveBall&lt;/code&gt; from the &lt;code&gt;MoveBallCommand&lt;/code&gt;.

For example for a &lt;code&gt;MoveBall10Command&lt;/code&gt; class, the execute method will be:

&lt;pre lang=&quot;actionscript3&quot;&gt;
public function execute():void
    {
        receiver.setSizeOfStep( 10 );
        receiver.moveBall();
    }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Barbara,</p>
<p>Executing commands generally result in some well-known behavior (not behavior that varies). So, it is a good idea to have multiple commands to move the square/circle by different amounts ( e.g. <code>MoveBall5Command</code>, <code>MoveBall10Command</code> etc. etc.)</p>
<p>However, you don&#8217;t need multiple receivers. The command &#8220;knows&#8221; the receiver. So, you can call the <code>setSizeOfStep</code> method before <code>moveBall</code> from the <code>MoveBallCommand</code>.</p>
<p>For example for a <code>MoveBall10Command</code> class, the execute method will be:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1380code3'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13803"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p1380code3"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> execute<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
    <span style="color: #000000;">&#123;</span>
        receiver<span style="color: #000066; font-weight: bold;">.</span>setSizeOfStep<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">10</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
        receiver<span style="color: #000066; font-weight: bold;">.</span>moveBall<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
</channel>
</rss>
