<?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>YAIMO BLOG &#187; Command</title>
	<atom:link href="http://blog.yaimo.net/category/progression/command/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yaimo.net</link>
	<description>会津の大食いFlasher!!　WordPress, iPhone, Progression, FlashDevelop他</description>
	<lastBuildDate>Thu, 29 Jul 2010 12:26:10 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Progression this の扱い(Q) 無名関数, Func, function</title>
		<link>http://blog.yaimo.net/2009/07/20/770/</link>
		<comments>http://blog.yaimo.net/2009/07/20/770/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 10:37:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Progression]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[ParallelList]]></category>
		<category><![CDATA[SerialList]]></category>

		<guid isPermaLink="false">http://blog.yaimo.net/?p=770</guid>
		<description><![CDATA[Progression this の扱い(破) 無名関数, Func, functionの続き。 Progressionクラスを生成し、コンストラクタで&#8221;id&#8221;を指定します。 this.id = &#34;yaimo&#34;; trace&#40;&#34;クラスのid: &#34;+this.id&#41;; //出力:クラスのid: yaimo trace&#40;&#34;普通にthis: &#34;+this&#41;; //出力:[IndexScene sceneId=&#34;/index&#34; id=&#34;yaimo&#34; name=&#34;index&#34; group=&#34;null&#34;] 今回はSerialList.addCommand()内でのthisの扱いについて、全体のコードはこんな感じです。 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 var sList:SerialList = new SerialList&#40;&#41;; sList.id = [...]]]></description>
			<content:encoded><![CDATA[<div>
Progression this の扱い(破) 無名関数, Func, functionの続き。<br />
<br />
Progressionクラスを生成し、<strong>コンストラクタで&#8221;id&#8221;を指定</strong>します。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;yaimo&quot;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;クラスのid: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">//出力:クラスのid: yaimo</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;普通にthis: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">//出力:[IndexScene sceneId=&quot;/index&quot; id=&quot;yaimo&quot; name=&quot;index&quot; group=&quot;null&quot;]</span></pre></div></div>

<br />
<br />
今回は<strong>SerialList</strong>.addCommand()内でのthisの扱いについて、全体のコードはこんな感じです。<br />
<br />

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> sList<span style="color: #000000; font-weight: bold;">:</span>SerialList = <span style="color: #0033ff; font-weight: bold;">new</span> SerialList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			sList.id = <span style="color: #990000;">&quot;sList&quot;</span>;
			sList.addCommand<span style="color: #000000;">&#40;</span>
				<span style="color: #009900;">//[		</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>,
				<span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;Function&quot;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>,
				<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.insertCommand<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;追加1&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
					insertCommand<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;追加2&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>,
&nbsp;
				<span style="color: #000000;">&#91;</span><span style="color: #009900;">//ここからParallelList</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> 
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>,
				<span style="color: #000000;">&#93;</span>,</pre></td></tr></table></div>

<br />
全体の出力結果です。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> yaimo
&nbsp;
SerialList.addCommand<span style="color: #000000;">&#40;</span>コード<span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">------</span><span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">---------</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_47&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;sList&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_42&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Function</span>
<span style="color: #000000; font-weight: bold;">-------------------------------------------------------------</span>
&nbsp;
SerialList.addCommand<span style="color: #000000;">&#40;</span>コード<span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">-----</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">----------</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.parentsList
<span style="color: #000000; font-weight: bold;">-------------------------------------------------------------</span>
追加<span style="color: #000000; font-weight:bold;">1</span>
&nbsp;
SerialList.ddCommand<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>コード<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">-----</span><span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">----------</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000; font-weight: bold;">:</span> <span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_48&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>ParallelList id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_54&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
<span style="color: #000000; font-weight: bold;">-------------------------------------------------------------</span></pre></div></div>

<br />
<br />
<hr /><br />
<br />
基本は前回とほとんど同じなので省きます。<br />
それで注目したいのが、10行目の<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SerialList.addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<br />
での出力が<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">SerialList.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;sList&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_42&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span></pre></div></div>

<br />
でthis.parentの参照がsListになることです。<br />
なので、19,20行目のthis.parentでsListにinsertCommandによる挿入を行わないと思ったとおりの実行をしてくれません。<br />
&#8220;追加１&#8221;の実行されるタイミングはfunctionのCommandが終わってから。<br />
&#8220;追加2&#8243;はおそらく、クラスに定義されているaddCommand()｛｝に登録されるんじゃないかと思われます。<br />
<br />
【まとめ】<br />
<ul>
	<li>new Func(function:void{}),function():void{}内での<strong>thisはFuncクラスを指す</strong>。</li>
<br />
	<li>SerialList.addCommand(){}の場合、function():void{this.parent}はSerialListを指す。</li>
</ul>
<br />
</div>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.yaimo.net/2009/07/19/746/" title="Progression this の扱い(破) 無名関数, Func, function (2009 年 7 月 19 日)">Progression this の扱い(破) 無名関数, Func, function</a></li>
	<li><a href="http://blog.yaimo.net/jsflmxp/" title="【Flash拡張】JSFL MXP まとめ (2009 年 7 月 31 日)">【Flash拡張】JSFL MXP まとめ</a></li>
	<li><a href="http://blog.yaimo.net/2009/07/18/730/" title="Progression this の扱い(序) 無名関数, Func, function (2009 年 7 月 18 日)">Progression this の扱い(序) 無名関数, Func, function</a></li>
	<li><a href="http://blog.yaimo.net/2009/08/29/882/" title="Progression 作成記録(1) (2009 年 8 月 29 日)">Progression 作成記録(1)</a></li>
	<li><a href="http://blog.yaimo.net/2009/07/13/703/" title="Progression URLObject の使い道 (2009 年 7 月 13 日)">Progression URLObject の使い道</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.yaimo.net/2009/07/20/770/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Progression this の扱い(破) 無名関数, Func, function</title>
		<link>http://blog.yaimo.net/2009/07/19/746/</link>
		<comments>http://blog.yaimo.net/2009/07/19/746/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 08:11:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Progression]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[ParallelList]]></category>
		<category><![CDATA[SerialList]]></category>

		<guid isPermaLink="false">http://blog.yaimo.net/?p=746</guid>
		<description><![CDATA[Progression this の扱い(序) 無名関数, Func, functionの続き。 Progressionクラスを生成し、コンストラクタで&#8221;id&#8221;を指定します。 this.id = &#34;yaimo&#34;; trace&#40;&#34;クラスのid: &#34;+this.id&#41;; //出力:クラスのid: yaimo trace&#40;&#34;普通にthis: &#34;+this&#41;; //出力:[IndexScene sceneId=&#34;/index&#34; id=&#34;yaimo&#34; name=&#34;index&#34; group=&#34;null&#34;] 今回はaddCommand()内でのthisの扱いについて、全体のコードはこんな感じです。 addCommand&#40; new Trace&#40;&#34;addCommand内でのthis.id: &#34; + this.id&#41;, new Func&#40;function &#40;&#41;:void &#123; trace&#40;&#34;addCommand内でのthis&#34; + this&#41;; trace&#40;&#34;addCommand内でのthis.parent&#34; + this.parent&#41;; this.id = &#34;Function&#34;; trace&#40;&#34;addCommand内でのthis.id: &#34; + this.id&#41;; trace&#40;&#34;addCommand内でのthis.parent.id: &#34; + this.parent.id&#41;; this.parent.id = &#34;parentはSerialList&#34;; trace&#40;&#34;addCommand内でのthis.parent&#34; + this.parent&#41;; [...]]]></description>
			<content:encoded><![CDATA[<div>
Progression this の扱い(序) 無名関数, Func, functionの続き。<br />
<br />
Progressionクラスを生成し、<strong>コンストラクタで&#8221;id&#8221;を指定</strong>します。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;yaimo&quot;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;クラスのid: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">//出力:クラスのid: yaimo</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;普通にthis: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">//出力:[IndexScene sceneId=&quot;/index&quot; id=&quot;yaimo&quot; name=&quot;index&quot; group=&quot;null&quot;]</span></pre></div></div>

<br />
<br />
今回はaddCommand()内でのthisの扱いについて、全体のコードはこんな感じです。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">addCommand<span style="color: #000000;">&#40;</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>,
				<span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;Function&quot;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id = <span style="color: #990000;">&quot;parentはSerialList&quot;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>,
				<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;fuction&quot;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent.id: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>,
				<span style="color: #000000;">&#91;</span><span style="color: #009900;">//ここからParallelList</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #339966; font-weight: bold;">function</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;Function&quot;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent.id: &quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>,
				<span style="color: #000000;">&#93;</span>
			<span style="color: #000000;">&#41;</span>;</pre></div></div>

<br />
<span id="more-746"></span><br />
全体の出力結果です。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">addCommand<span style="color: #000000;">&#40;</span>コード<span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">-----</span><span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">----------</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_12&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_4&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Function</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">null</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;parentはSerialList&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_4&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
&nbsp;
addCommand<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>コード<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">-----</span><span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">----------</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_28&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_4&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> fuction
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">null</span>
&nbsp;
addCommand<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>コード<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>での実験<span style="color: #000000; font-weight: bold;">-----</span><span style="color: #0033ff; font-weight: bold;">new</span> Func<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">----------</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_19&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>ParallelList id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_29&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Function</span>
addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">null</span></pre></div></div>

<br />
<br />
<hr /><br />
実際にコードを細かく見ていきます。<br />
<br />
まず2行目の、<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span></pre></div></div>

<br />
<br />
これは普通にクラス変数なので&#8221;yaimo&#8221;の出力です。<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> yaimo</pre></div></div>

<br />
<br />
5~11行目<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0033ff; font-weight: bold;">this</span>.id = <span style="color: #990000;">&quot;Function&quot;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent.id: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000;">&#41;</span>;
<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id = <span style="color: #990000;">&quot;parentはSerialList&quot;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;addCommand内でのthis.parent&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<br />
出力は<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">1.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>Func id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_12&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
2.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;null&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_4&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span>
3.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Function</span>
4.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.id<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">null</span>
5.addCommand内での<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span><span style="color: #000000;">&#91;</span>SerialList id=<span style="color: #990000;">&quot;parentはSerialList&quot;</span> <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;command_4&quot;</span> group=<span style="color: #990000;">&quot;null&quot;</span><span style="color: #000000;">&#93;</span></pre></div></div>

<br />
<br />
1.thisはFuncコマンドを指すようです。<br />
2.Funcコマンドの親はクラス全体のことを指すと思ったのですが、<br />
どうやらaddCommandで登録したSerialListの方を指すようです。<br />
3.1より、this = Funcなのでidを登録して出力しました。<br />
4.2からわかるようにSerialListのidは&#8221;null&#8221;です。<br />
5.なので同様に、this.parent.idを登録して出力しました。<br />
<br />
<hr /><br />
<br />
■じゃぁ、function():void{}でやってみたらどうなるの？っていうのが15~19行目。<br />
同じですね。function():void{}はnew Func(){function():void{}}を省略した書き方だった気がします。<br />
<br />
■3つ目は、addCommand()内に&#8221;[]&#8220;を使用することによってParallelListを使ったらどうなるかという実験です。<br />
this.parentがParallelListを参照するようになりました。<br />
なるほど、insertで追加するタイミングではParallelListにもなるということですね。<br />
これは応用できそうです。　<br />
<br />
【まとめ】<br />
<ul>
	<li>new Func(function:void{}),function():void{}内での<strong>thisはFuncクラスを指す</strong>。</li>
<br />
	<li>this.parentがSerialListなどを指してるのが意外。<br />
スーパークラスでaddCommand()を定義してあるだろうSerialListを指すのはあたりまえか（?)<br />
insertCommandをfunction内で記述する際は、クラスに定義されているaddCommand()｛｝に登録に追加するというイメージ<br />
<br />

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">addCommand<span style="color: #000000;">&#40;</span>
<span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
insertCommand<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Trace<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;this.addCommand()に追加&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<br />
</li></ul>
<br />
これが次につながってくる。つづく。</div>

	<h4>関連する投稿</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.yaimo.net/2009/07/20/770/" title="Progression this の扱い(Q) 無名関数, Func, function (2009 年 7 月 20 日)">Progression this の扱い(Q) 無名関数, Func, function</a></li>
	<li><a href="http://blog.yaimo.net/jsflmxp/" title="【Flash拡張】JSFL MXP まとめ (2009 年 7 月 31 日)">【Flash拡張】JSFL MXP まとめ</a></li>
	<li><a href="http://blog.yaimo.net/2009/07/18/730/" title="Progression this の扱い(序) 無名関数, Func, function (2009 年 7 月 18 日)">Progression this の扱い(序) 無名関数, Func, function</a></li>
	<li><a href="http://blog.yaimo.net/2009/08/29/882/" title="Progression 作成記録(1) (2009 年 8 月 29 日)">Progression 作成記録(1)</a></li>
	<li><a href="http://blog.yaimo.net/2009/07/13/703/" title="Progression URLObject の使い道 (2009 年 7 月 13 日)">Progression URLObject の使い道</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.yaimo.net/2009/07/19/746/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
