<?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>DESIRERY &#187; AS3</title>
	<atom:link href="http://www.t2-designing.com/blog/tag/as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.t2-designing.com/blog</link>
	<description></description>
	<lastBuildDate>Sun, 05 Sep 2010 07:12:45 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.t2-designing.com/blog/tag/as3/feed/" />
		<item>
		<title>addEventListener</title>
		<link>http://www.t2-designing.com/blog/2009/03/25/30/</link>
		<comments>http://www.t2-designing.com/blog/2009/03/25/30/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 18:17:50 +0000</pubDate>
		<dc:creator>Toyoshima</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.t2-designing.com/blog/?p=30</guid>
		<description><![CDATA[AS3でリスナー追加はものすごーくやるんですがAS3をものすごーくやらないのでメモ。無名関数のとこです。引数を渡したいとか。でも渡せないんだよ。とか。スキルがないんだよ。とか。頭 //普通に target.addEventListener&#40;MouseEvent.MOUSE_OUT, Listener&#41;; &#160; //無名関数で引数も渡しで自分もきえちゃう var hage:Text = new Text&#40;&#41;; hage.text = 'teramabushisu'; &#160; var Listener:Function = function&#40;e:MouseEvent&#41;:void &#123; _mouseOut&#40;hage&#41;; target.removeEventListener&#40;e.type, arguments.callee&#41;; &#125; target.addEventListener&#40;MouseEvent.MOUSE_OUT, Listener&#41;; &#160; private function _mouseOut&#40;hagehage:Text&#41;:void &#123; hagehage.alpha = 0.1; &#125; こんな感じで値を渡せたり。removeのところで使っているarguments.calleeを使って自身を消しちゃったり。 なんかソース用のCSSも作んないとね。よく見かけるのはライブラリかなんかででてるのかなー。 Share this on del.icio.us Add this to Google Bookmarks Share this on Facebook Post this to MySpace Tweet [...]]]></description>
			<content:encoded><![CDATA[<p>AS3でリスナー追加はものすごーくやるんですがAS3をものすごーくやらないのでメモ。無名関数のとこです。引数を渡したいとか。でも渡せないんだよ。とか。スキルがないんだよ。とか。頭</p>
<div class="syntax_hilite">
<div id="actionscript-2">
<div class="actionscript" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">//普通に</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0066CC;">target</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, Listener<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">//無名関数で引数も渡しで自分もきえちゃう</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">var</span> hage:<span style="color: #0066CC;">Text</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">hage.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">'teramabushisu'</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">var</span> Listener:<span style="color: #000000; font-weight: bold;">Function</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-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">_mouseOut<span style="color: #66cc66;">&#40;</span>hage<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0066CC;">target</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">type</span>, <span style="color: #0066CC;">arguments</span>.<span style="color: #0066CC;">callee</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0066CC;">target</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, Listener<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _mouseOut<span style="color: #66cc66;">&#40;</span>hagehage:<span style="color: #0066CC;">Text</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">hagehage.<span style="color: #006600;">alpha</span> = <span style="color: #cc66cc;color:#800000;">0.1</span>;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#26536A;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #66cc66;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
こんな感じで値を渡せたり。removeのところで使っているarguments.calleeを使って自身を消しちゃったり。</p>
<p>なんかソース用のCSSも作んないとね。よく見かけるのはライブラリかなんかででてるのかなー。</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.t2-designing.com/blog/2009/03/25/30/&amp;title=addEventListener" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.t2-designing.com/blog/2009/03/25/30/&amp;title=addEventListener" rel="nofollow" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.t2-designing.com/blog/2009/03/25/30/&amp;t=addEventListener" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.t2-designing.com/blog/2009/03/25/30/&amp;t=addEventListener" rel="nofollow" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=addEventListener+-+http://b2l.me/b5qrw+(via+@Toyotter)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-friendfeed">
			<a href="http://www.friendfeed.com/share?title=addEventListener&amp;link=http://www.t2-designing.com/blog/2009/03/25/30/" rel="nofollow" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="sexy-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.t2-designing.com%2Fblog%2F2009%2F03%2F25%2F30%2F&amp;t=addEventListener" rel="nofollow" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.t2-designing.com/blog/2009/03/25/30/&amp;title=addEventListener" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.t2-designing.com/blog/2009/03/25/30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.t2-designing.com/blog/2009/03/25/30/" />
	</item>
	</channel>
</rss>
