<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>宇都宮ウエブ制作所 &#187; 覚書</title>
	<atom:link href="http://utweb.jp/blog/archives/tag/%e8%a6%9a%e6%9b%b8/feed" rel="self" type="application/rss+xml" />
	<link>http://utweb.jp/blog</link>
	<description>宇都宮さんっていう、夫婦でやってるウエブサイト制作請負の大阪下町家内製手工業業務日誌</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:35:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/tag/%e8%a6%9a%e6%9b%b8/feed" />
		<item>
		<title>zen-codingにswfobjectなど微妙によく使うものを追加する</title>
		<link>http://utweb.jp/blog/archives/671</link>
		<comments>http://utweb.jp/blog/archives/671#comments</comments>
		<pubDate>Sat, 13 Mar 2010 05:42:07 +0000</pubDate>
		<dc:creator>正宗</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[DreamWeaver]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[swfobject]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[zen-coding]]></category>
		<category><![CDATA[まとめ]]></category>
		<category><![CDATA[便利]]></category>
		<category><![CDATA[覚書]]></category>

		<guid isPermaLink="false">http://utweb.jp/blog/?p=671</guid>
		<description><![CDATA[楽しいですね！zen-coding。
html:4t>(div#header>h1+ul.globalNavigation>li.navi$*6>a)+(div#content>div#main+div#sub)+(di [...]]]></description>
			<content:encoded><![CDATA[<p>楽しいですね！<a href="http://code.google.com/p/zen-coding/" target="_blank">zen-coding</a>。</p>
<pre>html:4t>(div#header>h1+ul.globalNavigation>li.navi$*6>a)+(div#content>div#main+div#sub)+(div#footer>ul.globalNavigation>li.navi$*6>a)</pre>
<p>こんなんが一行で書けてしまうので、ついつい仕事の本分を忘れて「いかにzen-codingで済ますか」ばかり興味が行っちゃって、大量にある面倒臭いコーディングもパズルを解くかのように楽しみながら作業できちゃいます。</p>
<p>せっかくなのでコーディングしてたら絶対出てくる他のいろいろと面倒なコードもzen-codingにまかせられないか、その方法を探って参りました。<br />
<span id="more-671"></span><br />
今や説明の必要もないくらい、Flashを埋め込む際に定番となったSWFObject。<br />
よく使うんだけど書き方を微妙に覚えて無くて、毎回どっかのサイトや過去の案件からコピペしてきてファイル名やサイズなんかを書き直してる、って方も多いと思います。<br />
せっかくzen-codingを使うのだから、</p>
<pre>swfobject</pre>
<p>と書けば一発でSWFObjectの記述を書き出すようにしたらいいですね！</p>
<p>参考にしたのはこちらのページ<br />
<a href="http://designblog.ecstudio.jp/htmlcss/my-zen-coding.html" target="_blank">Zen-Codingでさらにコーディングを1.5倍くらい速くするためのカスタマイズ方法</a><br />
もはや説明の必要もないくらいリンク先のページで非常にわかりやすく丁寧に解説されているので、これに習ってzen-codingにswdobjectの記述を追加するようカスタマイズしていきましょう。</p>
<h3>zen_setting.jsを探す</h3>
<p>僕の場合はWindowsVistaのDreamWeaverにzen-codingをインストールしましたので<br />
C:\Users\＜Windowsのユーザー名＞\AppData\Roaming\Adobe\Dreamweaver CS4\ja_JP\Configuration\Commands\ZenCoding<br />
ここに<strong>zen_setting.js</strong>はありました。<br />
Macだと<br />
/Users/＜Macのユーザー名＞/Library/Application Support/Adobe/Dreamweaver CS4/ja_JP/Configuration/Commands/ZenCodingです。<br />
環境によって違うと思いますのでまずは<strong>zen_setting.js</strong>を見つけて下さい。</p>
<h3>書き足す</h3>
<p>ファイル名を見てわかるように、中身はjavascriptになっています。<br />
javascriptになじみのある方は、もうこの時点で書き足す方法もわかったのではないでしょうか。<br />
このファイルの中身はzen_settingsというオブジェクトの固まりが書かれてあります。<br />
javascriptが苦手な方はこの時点で頭が痛いかも知れませんが、最後にコピペだけでカスタマイズできるようにしておきましたんで、もう少しおつきあい下さいね。</p>
<p>ほいで、このzen_settingsというオブジェクトの固まりをざーっと読んでいくと、どうやらその中にはsccとかhtmlっていうこれまた固まりがあって、さらにその中がsnippetsとかabbreviationsとかいう名前の固まりが入っている、みたいな形になっています。<br />
ちなみに<strong>zen_setting.js</strong>の3行目を読むと、このコードを書いた人の名前はセルゲイさんのようです。ハラショー！セルゲイ！！</p>
<p>なので、この<strong>zen_setting.js</strong>の最後の最後にこういう形で追加してやればいいです。<br />
最後の最後というのは、700何十行目かに</p>
<pre class="javascript"><span style="color: #66cc66;">&#125;</span>;</pre>
<p>で終わってると思うんですが、その後に改行とかして新しく追加していけばいいってことです。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">swfobject</span> =	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js&quot;&gt;&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'(function(){<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfDirectory = &quot;./swf/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfFileName = &quot;index.swf&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var targetId = &quot;flashcontent&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var width = &quot;600&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var height = &quot;400&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var version = &quot;9.0.0&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var flashvars = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	flashvars.varsDirectory = &quot;/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var params = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.menu = &quot;false&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.quality = &quot;best&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.scale = &quot;noscale&quot;;//showAll<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.salign = &quot;tl&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	//params.wmode = &quot;opaque&quot;;//transparent<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.swliveconnect = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowfullscreen = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowscriptaccess = &quot;always&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allownetworking = &quot;all&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var attributes = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.id = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.name = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.align = &quot;middle&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	swfobject.embedSWF(swfDirectory+swfFileName, targetId, width, height, version, swfDirectory+&quot;expressInstall.swf&quot;, flashvars, params, attributes);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'})();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</pre>
<p>僕が参考にしたリンク先では、最終的にmy_zen_setting.jsという独自ファイルで管理する前提のためファイルの途中の行に書き足していっていましたが、どっちが良い悪いというわけでもないですが僕の場合は<strong>zen_setting.js</strong>ファイルを直接触る前提のため、後から書き足していったところがわかりやすいので最後に書き足す方法をとりました。つまりもともとあったコードの中間には一切手を加えず、とにかく追加していくやり方ですね。</p>
<p>これでHTMLファイル上で</p>
<pre>swfobject</pre>
<p>と書いて最後尾でCtrl+,（コントロール＋カンマ）すればSWFObjectのややこしい記述が一発でずらずらと出てきます！WOOO！！</p>
<h3>せっかくなので他にも追加してみる</h3>
<p>GoogleAnalyticsのコードなんかも追加してみましょう。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">googleanalytics</span> = 	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'document.write(unescape(&quot;%3Cscript src=<span style="color: #000099; font-weight: bold;">\'</span>&quot; + gaJsHost + &quot;google-analytics.com/ga.js<span style="color: #000099; font-weight: bold;">\'</span> type=<span style="color: #000099; font-weight: bold;">\'</span>text/javascript<span style="color: #000099; font-weight: bold;">\'</span>%3E%3C/script%3E&quot;));<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'try{<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var pageTracker = _gat._getTracker(&quot;UA-|xxxxxx-x&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'pageTracker._trackPageview();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'} catch(err) {}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</pre>
<p>CSSのclearfixのコードなんかも<br />
<a href="http://www.yomotsu.net/wp/?p=561" target="_blank">いまどき ? いまさら ? clear fix のコード</a><br />
こちらを参考に書いてみました。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">css</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">clearfix</span> =	<span style="color: #3366CC;">&quot;.clearfix { /zoom : 1; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> +
					<span style="color: #3366CC;">&quot;.clearfix:after { content: ''; display: block; clear: both; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span></pre>
<p>書き方のコツがわかったら、ほかにもどんどんと自分好みのzen-codingができそうです。</p>
<h3>コードをまとめてみた</h3>
<p>今回紹介した3つの追加項目をまとめときました。</p>
<pre class="javascript"><span style="color: #009900; font-style: italic;">/**
 *	added 2010/03/13
 *	http://utweb.jp/
 *	Masamune Utsunomiya
 **/</span>
zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">swfobject</span> =	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js&quot;&gt;&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'(function(){<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfDirectory = &quot;./swf/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfFileName = &quot;index.swf&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var targetId = &quot;flashcontent&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var width = &quot;600&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var height = &quot;400&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var version = &quot;9.0.0&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var flashvars = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	flashvars.varsDirectory = &quot;/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var params = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.menu = &quot;false&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.quality = &quot;best&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.scale = &quot;noscale&quot;;//showAll<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.salign = &quot;tl&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	//params.wmode = &quot;opaque&quot;;//transparent<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.swliveconnect = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowfullscreen = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowscriptaccess = &quot;always&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allownetworking = &quot;all&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var attributes = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.id = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.name = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.align = &quot;middle&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	swfobject.embedSWF(swfDirectory+swfFileName, targetId, width, height, version, swfDirectory+&quot;expressInstall.swf&quot;, flashvars, params, attributes);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'})();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;
zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">googleanalytics</span> = 	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'document.write(unescape(&quot;%3Cscript src=<span style="color: #000099; font-weight: bold;">\'</span>&quot; + gaJsHost + &quot;google-analytics.com/ga.js<span style="color: #000099; font-weight: bold;">\'</span> type=<span style="color: #000099; font-weight: bold;">\'</span>text/javascript<span style="color: #000099; font-weight: bold;">\'</span>%3E%3C/script%3E&quot;));<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'try{<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var pageTracker = _gat._getTracker(&quot;UA-|xxxxxx-x&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'pageTracker._trackPageview();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'} catch(err) {}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;
zen_settings.<span style="color: #006600;">css</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">clearfix</span> =	<span style="color: #3366CC;">&quot;.clearfix { /zoom : 1; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> +
					<span style="color: #3366CC;">&quot;.clearfix:after { content: ''; display: block; clear: both; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span></pre>
<p>ようはいままでの記事ぜんぶすっ飛ばして読んでない人も、このコードをまるごとコピーして<strong>zen_setting.js</strong>の最後に貼り付けておけばいいって事です！</p>
<p>みなさんも「こんなのもスニペットにしてみたよ」ってのがあれば是非おしえてくださいませ。<br />
では良いzen-codingを！ハラショー！</p>
]]></content:encoded>
			<wfw:commentRss>http://utweb.jp/blog/archives/671/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/671" />
	</item>
		<item>
		<title>ActionScriptイベントリスナの外にある変数を使いたい</title>
		<link>http://utweb.jp/blog/archives/627</link>
		<comments>http://utweb.jp/blog/archives/627#comments</comments>
		<pubDate>Thu, 11 Feb 2010 02:55:10 +0000</pubDate>
		<dc:creator>正宗</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[覚書]]></category>

		<guid isPermaLink="false">http://utweb.jp/blog/?p=627</guid>
		<description><![CDATA[すいません。wonferfl本まだ買っていません。今すぐ読みたい！正宗です。
今回は僕がいつも忘れてしまうことを備忘録がわりに書いておきます。

まずはやりたいことは次のようなこと。
package &#123;     [...]]]></description>
			<content:encoded><![CDATA[<p>すいません。wonferfl本まだ買っていません。今すぐ読みたい！正宗です。<br />
今回は僕がいつも忘れてしまうことを備忘録がわりに書いておきます。<br />
<span id="more-627"></span><br />
まずはやりたいことは次のようなこと。</p>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextFieldAutoSize</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FlashTest <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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> FlashTest<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            <span style="color: #000000; font-weight: bold;">var</span> tf:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			tf.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;ここに数字が表示されます。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			addChild<span style="color: #66cc66;">&#40;</span>tf<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginWidth:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">5.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginHeight:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">15.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> l:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">5</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i &lt; l; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = createCircle<span style="color: #66cc66;">&#40;</span>radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>sp.<span style="color: #0066CC;">width</span> + marginWidth<span style="color: #66cc66;">&#41;</span> * i<span style="color: #66cc66;">&#41;</span> + radius;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">y</span> = tf.<span style="color: #0066CC;">height</span> + marginHeight;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				addChild<span style="color: #66cc66;">&#40;</span>sp<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #808080; font-style: italic;">//このコードではどのボタンを押してもテキストフィールドには5が表示される</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">						tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;このボタンナンバーは　&quot;</span> + i + <span style="color: #ff0000;">&quot;です。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #66cc66;">&#125;</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//なぜならfor文を抜けたこの時点での変数iの中には5が入っているから。</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #808080; font-style: italic;">//　このコードよりももっと後なので、その時の変数iを探しにいってしまう）</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createCircle<span style="color: #66cc66;">&#40;</span>radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>, <span style="color: #0066CC;">color</span>:uint = 0xFF0000<span style="color: #66cc66;">&#41;</span>:Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> g:Graphics = sp.<span style="color: #006600;">graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">endFill</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">return</span> sp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>実験結果はこう。</p>
<div style="text-align:center;width:465px;"><iframe title="イベントリスナの外にある変数を匿名関数で使いたい - wonderfl build flash online" scrolling="no" src="http://wonderfl.net/blogparts/455f8c9d2688821d45212d87d97de6081a1e1648" width="465" height="490" style="border:1px black solid;"></iframe><a href="http://wonderfl.net/code/455f8c9d2688821d45212d87d97de6081a1e1648" title="イベントリスナの外にある変数を匿名関数で使いたい - wonderfl build flash online">イベントリスナの外にある変数を匿名関数で使いたい - wonderfl build flash online</a></div>
<p>どのボタンを押しても５と表示されてしまいます。<br />
僕が出してる解決方法は次の二通り。場合によって使い分けてます。</p>
<h3>方法その1：イベントリスナに引数を渡してやる</h3>
<div style="text-align:center;width:465px;"><iframe title="方法その1：イベントリスナに引数を渡してやる - wonderfl build flash online" scrolling="no" src="http://wonderfl.net/blogparts/857ecfcd70a4a39abec9d1345547c1f0a401ab32" width="465" height="490" style="border:1px black solid;"></iframe><a href="http://wonderfl.net/code/857ecfcd70a4a39abec9d1345547c1f0a401ab32" title="方法その1：イベントリスナに引数を渡してやる - wonderfl build flash online">方法その1：イベントリスナに引数を渡してやる - wonderfl build flash online</a></div>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// forked from hacker_ij9oiq_p's flash on 2010-2-11</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextFieldAutoSize</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FlashTest <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _tf:<span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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> FlashTest<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            _tf = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_tf.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			_tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;ここに数字が表示されます。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			addChild<span style="color: #66cc66;">&#40;</span>_tf<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginWidth:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">5.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginHeight:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">15.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> l:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">5</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i &lt; l; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = createCircle<span style="color: #66cc66;">&#40;</span>radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>sp.<span style="color: #0066CC;">width</span> + marginWidth<span style="color: #66cc66;">&#41;</span> * i<span style="color: #66cc66;">&#41;</span> + radius;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">y</span> = _tf.<span style="color: #0066CC;">height</span> + marginHeight;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				addChild<span style="color: #66cc66;">&#40;</span>sp<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #808080; font-style: italic;">//方法その1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, onClickHandler<span style="color: #66cc66;">&#40;</span>i<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;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onClickHandler<span style="color: #66cc66;">&#40;</span>idNumber:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #000000; font-weight: bold;">Function</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					_tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;このボタンナンバーは　&quot;</span> + idNumber + <span style="color: #ff0000;">&quot;です。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createCircle<span style="color: #66cc66;">&#40;</span>radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>, <span style="color: #0066CC;">color</span>:uint = 0xFF0000<span style="color: #66cc66;">&#41;</span>:Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> g:Graphics = sp.<span style="color: #006600;">graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">endFill</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">return</span> sp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<h3>方法その2：クロージャーに閉じ込めてしまう</h3>
<div style="text-align:center;width:465px;"><iframe title="方法その2：クロージャーに閉じ込めてしまう - wonderfl build flash online" scrolling="no" src="http://wonderfl.net/blogparts/4479dc3618ab76ffcec6c491f3b14b53482fc234" width="465" height="490" style="border:1px black solid;"></iframe><a href="http://wonderfl.net/code/4479dc3618ab76ffcec6c491f3b14b53482fc234" title="方法その2：クロージャーに閉じ込めてしまう - wonderfl build flash online">方法その2：クロージャーに閉じ込めてしまう - wonderfl build flash online</a></div>
<pre class="actionscript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// forked from hacker_ij9oiq_p's flash on 2010-2-11</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextFieldAutoSize</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FlashTest <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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> FlashTest<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">            <span style="color: #000000; font-weight: bold;">var</span> tf:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			tf.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;ここに数字が表示されます。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			addChild<span style="color: #66cc66;">&#40;</span>tf<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginWidth:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">5.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> marginHeight:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">15.0</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> l:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">5</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i &lt; l; i++<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = createCircle<span style="color: #66cc66;">&#40;</span>radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>sp.<span style="color: #0066CC;">width</span> + marginWidth<span style="color: #66cc66;">&#41;</span> * i<span style="color: #66cc66;">&#41;</span> + radius;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				sp.<span style="color: #006600;">y</span> = tf.<span style="color: #0066CC;">height</span> + marginHeight;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				addChild<span style="color: #66cc66;">&#40;</span>sp<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #808080; font-style: italic;">//方法その2</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					<span style="color: #000000; font-weight: bold;">var</span> idNumber:<span style="color: #0066CC;">int</span> = i;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					sp.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">							tf.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;このボタンナンバーは　&quot;</span> + idNumber + <span style="color: #ff0000;">&quot;です。&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">					<span style="color: #66cc66;">&#125;</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><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;"><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;"><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;"><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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createCircle<span style="color: #66cc66;">&#40;</span>radius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10.0</span>, <span style="color: #0066CC;">color</span>:uint = 0xFF0000<span style="color: #66cc66;">&#41;</span>:Sprite <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> sp:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000000; font-weight: bold;">var</span> g:Graphics = sp.<span style="color: #006600;">graphics</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">color</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, radius<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			g.<span style="color: #0066CC;">endFill</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;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #b1b100;">return</span> sp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>いや～便利便利。<br />
僕もまだまだ勉強中の身ですので、他にもこういうやり方もあるよ！って方法あれば是非是非教えて下さい！</p>
]]></content:encoded>
			<wfw:commentRss>http://utweb.jp/blog/archives/627/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/627" />
	</item>
	</channel>
</rss>

