<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Commenti a: Very short trick: addEventListener() AS3, un handler più eventi</title>
	<atom:link href="http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/</link>
	<description>Research &#38; Development  Blog</description>
	<lastBuildDate>Thu, 09 Feb 2012 11:24:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>Di: Giovambattista Fazioli</title>
		<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/#comment-2555</link>
		<dc:creator>Giovambattista Fazioli</dc:creator>
		<pubDate>Wed, 02 Dec 2009 20:24:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=1118#comment-2555</guid>
		<description>&lt;b&gt;@Roberto&lt;/b&gt;: ottimo! Sempre per concludere, se la serie di &quot;pulsanti&quot; (MovieClip) sono inseriti in un MovieClip contenitore, puoi addirittura evitare l&#039;array e ciclare su tutti i &quot;figli&quot; del contenitore stesso. Al riguardo ti consiglio di leggere &lt;a href=&quot;http://www.undolog.com/2008/03/11/tutto-quello-che-avete-sempre-sognato-di-fare-con-actionscript-3/&quot; rel=&quot;nofollow&quot;&gt;Tutto quello che avete sempre sognato di fare con Actionscript 3&lt;/a&gt;
Saluti e grazie per i tuoi contributi</description>
		<content:encoded><![CDATA[<p><b>@Roberto</b>: ottimo! Sempre per concludere, se la serie di &#8220;pulsanti&#8221; (MovieClip) sono inseriti in un MovieClip contenitore, puoi addirittura evitare l&#8217;array e ciclare su tutti i &#8220;figli&#8221; del contenitore stesso. Al riguardo ti consiglio di leggere <a href="http://www.undolog.com/2008/03/11/tutto-quello-che-avete-sempre-sognato-di-fare-con-actionscript-3/" rel="nofollow">Tutto quello che avete sempre sognato di fare con Actionscript 3</a><br />
Saluti e grazie per i tuoi contributi</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Roberto</title>
		<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/#comment-2553</link>
		<dc:creator>Roberto</dc:creator>
		<pubDate>Wed, 02 Dec 2009 18:15:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=1118#comment-2553</guid>
		<description>&lt;b&gt;@Roberto&lt;/b&gt;: mi permetto di concludere, nel caso qualcun&#039;altro cercasse info a riguardo, che nel caso appunto di più mc (es: pulsanti), con un array e un clico è possibile raggruppare i vari mc ed assegnare gli &quot;addEventListener&quot; es:
[cc_actionscript3]for (var i:int=0; i&lt;btn_array.length; i++) {
btn_array[i].addEventListener( MouseEvent.CLICK, on_handler );
btn_array[i].addEventListener( MouseEvent.MOUSE_OVER, on_handler );
btn_array[i].addEventListener( MouseEvent.MOUSE_OUT, on_handler );
}[/cc_actionscript3].....salve e spero di essere utile a qualcunaltro....:)</description>
		<content:encoded><![CDATA[<p><b>@Roberto</b>: mi permetto di concludere, nel caso qualcun&#8217;altro cercasse info a riguardo, che nel caso appunto di più mc (es: pulsanti), con un array e un clico è possibile raggruppare i vari mc ed assegnare gli &#8220;addEventListener&#8221; es:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">&lt;</span>btn_array<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
btn_array<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> on_handler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
btn_array<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">,</span> on_handler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
btn_array<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">,</span> on_handler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>&#8230;..salve e spero di essere utile a qualcunaltro&#8230;.:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Roberto</title>
		<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/#comment-2552</link>
		<dc:creator>Roberto</dc:creator>
		<pubDate>Wed, 02 Dec 2009 18:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=1118#comment-2552</guid>
		<description>&lt;b&gt;@Giovambattista Fazioli&lt;/b&gt;: Bhe che dire, avevo provato da buon smanettone con 
[cc_actionscript3](e.currentTarget.name).gotoAndPlay(2)[\as].....tolto il .name e via le parentesi.....e funzia...quindi GRAZIE....:)</description>
		<content:encoded><![CDATA[<p><b>@Giovambattista Fazioli</b>: Bhe che dire, avevo provato da buon smanettone con<br />
[cc_actionscript3](e.currentTarget.name).gotoAndPlay(2)[\as]&#8230;..tolto il .name e via le parentesi&#8230;..e funzia&#8230;quindi GRAZIE&#8230;.:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Giovambattista Fazioli</title>
		<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/#comment-2551</link>
		<dc:creator>Giovambattista Fazioli</dc:creator>
		<pubDate>Wed, 02 Dec 2009 17:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=1118#comment-2551</guid>
		<description>&lt;b&gt;@Roberto&lt;/b&gt;: è molto semplice: &lt;code inline=&quot;true&quot;&gt;e.target&lt;/code&gt; è un puntatore all&#039;istanza del MovieClip, quindi basta usare:
[cc_actionscript3]
e.target.gotoAndPlay(2);
[/cc_actionscript3]
In pratica &lt;code inline=&quot;true&quot;&gt;btn1_mc&lt;/code&gt;, o qualsiasi altra istanza, corrisponde a &lt;code inline=&quot;true&quot;&gt;e.target&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><b>@Roberto</b>: è molto semplice: <code class="codecolorer text default"><span class="text">e.target</span></code> è un puntatore all&#8217;istanza del MovieClip, quindi basta usare:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>In pratica <code class="codecolorer text default"><span class="text">btn1_mc</span></code>, o qualsiasi altra istanza, corrisponde a <code class="codecolorer text default"><span class="text">e.target</span></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Roberto</title>
		<link>http://www.undolog.com/2009/01/06/very-short-trick-addeventlistener-as3-un-handler-piu-eventi/#comment-2550</link>
		<dc:creator>Roberto</dc:creator>
		<pubDate>Wed, 02 Dec 2009 16:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=1118#comment-2550</guid>
		<description>&lt;b&gt;@Giovambattista Fazioli&lt;/b&gt;:
[cc_actionscript3]
btn1_mc.addEventListener( MouseEvent.MOUSE_OVER, on_handler );
btn1_mc.addEventListener( MouseEvent.MOUSE_OUT, on_handler );

function on_handler ( e:MouseEvent ){
    switch( e.type ) {
        case MouseEvent.MOUSE_OVER:
             trace(e.currentTarget.name);//funziona, visualizza &quot;btn1_mc&quot; ossia il nome dell&#039;istanza del primo pulsante
	     btn1_mc.gotoAndPlay(2);
             break;
        case MouseEvent.MOUSE_OUT:
             btn1_mc.gotoAndPlay(16);
             break;
    }
}[/cc_actionscript3] 
Quindi [cc_actionscript3]trace(e.currentTarget.name)[/cc_actionscript3] funziona, ma come posso associarlo all&#039;istruzione sucessiva? al posto di [cc_actionscript3] btn1_mc.gotoAndPlay(2);[/cc_actionscript3]</description>
		<content:encoded><![CDATA[<p><b>@Giovambattista Fazioli</b>:</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">btn1_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">,</span> on_handler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
btn1_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">,</span> on_handler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #339966; font-weight: bold;">function</span> on_handler <span style="color: #000000;">&#40;</span> e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">switch</span><span style="color: #000000;">&#40;</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">type</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">case</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//funziona, visualizza &quot;btn1_mc&quot; ossia il nome dell'istanza del primo pulsante</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;btn1_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">case</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;btn1_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">16</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>Quindi</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span></div></td></tr></tbody></table></div>
<p>funziona, ma come posso associarlo all&#8217;istruzione sucessiva? al posto di</p>
<div class="codecolorer-container actionscript3 vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;btn1_mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
</channel>
</rss>

