<?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>Comments on: Passing Parameters with Flash&#8217;s Delegate Class</title>
	<atom:link href="http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/</link>
	<description>Let us toast your non-idiocy</description>
	<lastBuildDate>Thu, 26 Aug 2010 19:47:06 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: j.c Pimentel</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-1559</link>
		<dc:creator>j.c Pimentel</dc:creator>
		<pubDate>Sun, 02 May 2010 23:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-1559</guid>
		<description>i implement this solution a couple times and  works ok but i found a better solution to do this in a elegant way , using a modification of the create function of the Delegate class. 

function DelegateCreate(t:Object, f:Function,args:Array):Function
    {       
        return  function():Void
        {			
			if ((args == undefined) &#124;&#124; (args == null))
				args=[]			
            var _newArgs:Array = args.concat(arguments);			
            f.apply(t, args);
        };      
    }

var movie_clip.onPress=DelegateCreate(this,onPressFunc,[1,2,3,4,&quot;cool&quot;] )

and here is the function 

function onPressFunc(arg1,arg2,arg3,arg,4,arg5)
{
  //N args of any king or type that you pass using the parameter array.
 
}</description>
		<content:encoded><![CDATA[<p>i implement this solution a couple times and  works ok but i found a better solution to do this in a elegant way , using a modification of the create function of the Delegate class. </p>
<p>function DelegateCreate(t:Object, f:Function,args:Array):Function<br />
    {<br />
        return  function():Void<br />
        {<br />
			if ((args == undefined) || (args == null))<br />
				args=[]<br />
            var _newArgs:Array = args.concat(arguments);<br />
            f.apply(t, args);<br />
        };<br />
    }</p>
<p>var movie_clip.onPress=DelegateCreate(this,onPressFunc,[1,2,3,4,"cool"] )</p>
<p>and here is the function </p>
<p>function onPressFunc(arg1,arg2,arg3,arg,4,arg5)<br />
{<br />
  //N args of any king or type that you pass using the parameter array.</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-263</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Sun, 06 Jul 2008 15:06:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-263</guid>
		<description>Absolutely brilliant! Saved my day. Thank you!</description>
		<content:encoded><![CDATA[<p>Absolutely brilliant! Saved my day. Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toby Skinner</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-262</link>
		<dc:creator>Toby Skinner</dc:creator>
		<pubDate>Sun, 17 Jun 2007 10:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-262</guid>
		<description>nice, very handy</description>
		<content:encoded><![CDATA[<p>nice, very handy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Merrill</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-261</link>
		<dc:creator>Jason Merrill</dc:creator>
		<pubDate>Sat, 03 Mar 2007 05:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-261</guid>
		<description>Awesome!  Thanks for posting this, I had always wondered about that and never found a reason. I had all kinds of kludgy
workarounds previously, but now this makes sense and I&#039;m using it. AS3 gets rid of Delegate, but this is great until we
all make the transition.</description>
		<content:encoded><![CDATA[<p>Awesome!  Thanks for posting this, I had always wondered about that and never found a reason. I had all kinds of kludgy<br />
workarounds previously, but now this makes sense and I&#8217;m using it. AS3 gets rid of Delegate, but this is great until we<br />
all make the transition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Morgan</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-260</link>
		<dc:creator>Scott Morgan</dc:creator>
		<pubDate>Wed, 18 Oct 2006 02:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-260</guid>
		<description>Well, guess this blog doesn&#039;t like &lt; signs. Let me try this again. Easy:

private function drawMenu():Void {
     var len:Number = 0;
     var x:Number = 0;
     __buttonArray = new Array();
     for (var i:Number = 0;i&lt;len;i++) {
          var button = __instance.attachMovie(&#039;myButton&#039;, &#039;myButton&#039;+i+&#039;_mc&#039;, i);
          button._x = x;
          button.label = &#039;Button &#039; + i;
          x += button._width;
          __buttonArray.push(button);
          var clickDel = button.onRelease = Delegate.create(this, buttonClicked);
          clickDel.id = i;
     }
}

private function buttonClicked():Void {
     var id:Number = arguments.caller.id;
     trace(&#039;The id for the selected button is: &#039; + id);
     trace(&#039;The path to this button is: &#039; + __buttonArray[id] + &#039; or &#039; + __instance[&#039;myButton&#039;+id+&#039;_mc&#039;]);
}

Hope this helps, and I hope your blog doesn&#039;t blow up again when I submit this :)</description>
		<content:encoded><![CDATA[<p>Well, guess this blog doesn&#8217;t like &lt; signs. Let me try this again. Easy:</p>
<p>private function drawMenu():Void {<br />
     var len:Number = 0;<br />
     var x:Number = 0;<br />
     __buttonArray = new Array();<br />
     for (var i:Number = 0;i&lt;len;i++) {<br />
          var button = __instance.attachMovie(&#8217;myButton&#8217;, &#8216;myButton&#8217;+i+&#8217;_mc&#8217;, i);<br />
          button._x = x;<br />
          button.label = &#8216;Button &#8216; + i;<br />
          x += button._width;<br />
          __buttonArray.push(button);<br />
          var clickDel = button.onRelease = Delegate.create(this, buttonClicked);<br />
          clickDel.id = i;<br />
     }<br />
}</p>
<p>private function buttonClicked():Void {<br />
     var id:Number = arguments.caller.id;<br />
     trace(&#8217;The id for the selected button is: &#8216; + id);<br />
     trace(&#8217;The path to this button is: &#8216; + __buttonArray[id] + &#8216; or &#8216; + __instance['myButton'+id+'_mc']);<br />
}</p>
<p>Hope this helps, and I hope your blog doesn&#8217;t blow up again when I submit this <img src='http://blog.alastairdawson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Morgan</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-259</link>
		<dc:creator>Scott Morgan</dc:creator>
		<pubDate>Wed, 18 Oct 2006 01:54:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-259</guid>
		<description>Easy:

private function drawMenu():Void {

var len:Number = 0;
var x:Number = 0;
for (var i:Number = 0;i</description>
		<content:encoded><![CDATA[<p>Easy:</p>
<p>private function drawMenu():Void {</p>
<p>var len:Number = 0;<br />
var x:Number = 0;<br />
for (var i:Number = 0;i</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Judio</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-258</link>
		<dc:creator>Judio</dc:creator>
		<pubDate>Tue, 17 Oct 2006 10:33:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-258</guid>
		<description>What happens if you are trying to set up a number of buttons within a for loop and want to pass the id of each button using the Delegate class? For example:

import mx.utils.Delegate;

class Whatever extends MovieClip {

private var someClip_mc:MovieClip;
private var someList:Array;

function Whatever() {
for(var i=0; i</description>
		<content:encoded><![CDATA[<p>What happens if you are trying to set up a number of buttons within a for loop and want to pass the id of each button using the Delegate class? For example:</p>
<p>import mx.utils.Delegate;</p>
<p>class Whatever extends MovieClip {</p>
<p>private var someClip_mc:MovieClip;<br />
private var someList:Array;</p>
<p>function Whatever() {<br />
for(var i=0; i</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Morgan</title>
		<link>http://blog.alastairdawson.com/2006/10/04/passing-parameters-with-flashs-delegate-class/comment-page-1/#comment-257</link>
		<dc:creator>Scott Morgan</dc:creator>
		<pubDate>Mon, 09 Oct 2006 05:35:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.vixiom.com/2006/10/04/passing-parameters-with-flashs-delegate-class/#comment-257</guid>
		<description>Hey man, thanks for the props. Glad you liked the tutorial.</description>
		<content:encoded><![CDATA[<p>Hey man, thanks for the props. Glad you liked the tutorial.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
