<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: actionscript help for a non programmer who wants to do it the right way</title>
	<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way/</link>
	<description>Comments on Ask MetaFilter post actionscript help for a non programmer who wants to do it the right way</description>
	<pubDate>Thu, 29 Jun 2006 11:34:48 -0800</pubDate>
	<lastBuildDate>Thu, 29 Jun 2006 11:34:48 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: actionscript help for a non programmer who wants to do it the right way</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way</link>	
		<description>OK. So I have five movie clips on the stage named b1 - b5. When the user clicks on one the other four need to gotoAndPlay. I could write a function for one object then cut and paste and just change the names, but that seems inelegant. What I think I need to do is generate an array containing the five objects, then, when the user clicks on one of them, that one is removed from the array and triggers a function that loops through the remaining clips in the array and does the goto. Does that make sense? And if so, how would I do it? And if not, what is a better way? In other words, user clicks on movie named b1 and b2-b5 do something. user clicks on movie named b3 and b1,b2,b4, and b5 do something. Thanks! &lt;br /&gt;&lt;br /&gt; OH. One other thing. After the stage is cleared of all but one clip (that&apos;s the animation that the goto goes to) the remaining clip must play an animation.&lt;br&gt;
&lt;br&gt;
My level of experience ranks slightly below that of chipmunk&apos;s, so any example code w/ comments would be greatly appriciated.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.41184</guid>
		<pubDate>Thu, 29 Jun 2006 11:11:55 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
		
			<category>flash</category>
		
			<category>actionScript</category>
		
			<category>arrrgh</category>
		
	</item> <item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634229</link>	
		<description>In&amp;nbsp;C++:&lt;br&gt;
&lt;br&gt;
class&amp;nbsp;clip&amp;nbsp;{&amp;nbsp;&lt;br&gt;
&amp;nbsp; public:&lt;br&gt;
&amp;nbsp;&amp;nbsp;void&amp;nbsp;play()&amp;nbsp;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;void&amp;nbsp;gotoandPlay()&amp;nbsp;;&lt;br&gt;
}&amp;nbsp; ;&lt;br&gt;
&lt;br&gt;
clip&amp;nbsp;arrayOfClips[&amp;nbsp;5&amp;nbsp;]&amp;nbsp;;&lt;br&gt;
&lt;br&gt;
void&amp;nbsp;onClick(&amp;nbsp;int&amp;nbsp;whichClip&amp;nbsp;)&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;const&amp;nbsp;int&amp;nbsp;clipCount&amp;nbsp;=&amp;nbsp;arrayOfClips&amp;nbsp;/&amp;nbsp;arrayOfClips[&amp;nbsp;0&amp;nbsp;]&amp;nbsp;&amp;nbsp;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;if(&amp;nbsp;whichClip&amp;nbsp;&amp;gt;=&amp;nbsp;clipCount&amp;nbsp;)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw&amp;nbsp;std::out_of_range(&amp;nbsp;&quot;There&amp;nbsp;aren&apos;t&amp;nbsp;that&amp;nbsp;many&amp;nbsp;clips,&amp;nbsp;mr.&amp;nbsp;programer&quot;&amp;nbsp;)&amp;nbsp;;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;for(&amp;nbsp;int&amp;nbsp;i&amp;nbsp;=&amp;nbsp;0&amp;nbsp;;&amp;nbsp;i&amp;nbsp;&lt; &amp;nbsp;;&amp;nbsp;++i&amp;nbsp;)&amp;nbsp;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&amp;nbsp;i&amp;nbsp;!=&amp;nbsp;whichClip&amp;nbsp;)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayOfClips[&amp;nbsp;i&amp;nbsp;].gotoandPlay()&amp;nbsp;;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayOfClips[&amp;nbsp;whichClip&amp;nbsp;].play()&amp;nbsp;;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&lt;br&gt;
I don&apos;t know what language you&apos;re using, but this C++ code should be easy enough to follow. Of course, the definition of class clip is left to you; I&apos;m &quot;assuming&quot; the clips don&apos;t need to be initialized, which of course isn&apos;t true.&lt;br&gt;
&lt;br&gt;
Summary: you don&apos;t need to remove stuff from the array, you just need to call gotoAndPlay on all clips but the one selected, and then call play on that one.&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634229</guid>
		<pubDate>Thu, 29 Jun 2006 11:34:48 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634230</link>	
		<description>I don&apos;t quite understand your second-to-last paragraph, but the main part should go something like this:&lt;br&gt;
&lt;br&gt;
var numClips:Number = 5;&lt;br&gt;
var strPrefix:String = &quot;b&quot;;&lt;br&gt;
&lt;br&gt;
init();&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//assigns the function playOthers to the onRelease&lt;br&gt;
//event handler for each movieclip&lt;br&gt;
function init():Void&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; numclips; i++)br&gt;
{&lt;br&gt;
_root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
} //end function init&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//makes each clip, except the one calling this function&lt;br&gt;
//gotoAndPlay&lt;br&gt;
function playOthers():Void&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
var mc:MovieClip;&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; numclips; i++)br&gt;
{&lt;br&gt;
&lt;br&gt;
mc =  _root[strPrefix + i];&lt;br&gt;
&lt;br&gt;
if (mc._name != this._name)&lt;br&gt;
{&lt;br&gt;
mc.gotoAndPlay(&quot;someFrame&quot;);&lt;br&gt;
} //end if&lt;br&gt;
&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
} //end function playOthers&lt;/&gt;&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634230</guid>
		<pubDate>Thu, 29 Jun 2006 11:35:36 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634232</link>	
		<description>Sorry about my lack of indents. I never can figure out how to format code for AskMe.&lt;br&gt;
&lt;br&gt;
By the way, I was assuming that your clips are numbers b0, b1, b2... If the first one is b1, not b0, then change the two for loops to the following:&lt;br&gt;
&lt;br&gt;
for (var i:Number = 1; i &amp;lt;= numClips; i++)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634232</guid>
		<pubDate>Thu, 29 Jun 2006 11:37:46 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634233</link>	
		<description>Argh, I forgot to escape the less than symbol.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;for(&amp;nbsp;int&amp;nbsp;i&amp;nbsp;=&amp;nbsp;0&amp;nbsp;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;countClips&amp;nbsp;;&amp;nbsp;++i&amp;nbsp;)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&amp;nbsp;i&amp;nbsp;!=&amp;nbsp;whichClip&amp;nbsp;)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;arrayOfClips[&amp;nbsp;i&amp;nbsp;].gotoandPlay()&amp;nbsp;;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634233</guid>
		<pubDate>Thu, 29 Jun 2006 11:37:49 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: Lord_Pall</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634236</link>	
		<description>It sounds like this is an actionscript question.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634236</guid>
		<pubDate>Thu, 29 Jun 2006 11:39:19 -0800</pubDate>
		<dc:creator>Lord_Pall</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634238</link>	
		<description>And I forgot two sizeof()s.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634238</guid>
		<pubDate>Thu, 29 Jun 2006 11:40:57 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: Lord_Pall</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634239</link>	
		<description>Grod can you translate the c++ into actionscript or do you need a specific set of actionscript code?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634239</guid>
		<pubDate>Thu, 29 Jun 2006 11:41:42 -0800</pubDate>
		<dc:creator>Lord_Pall</dc:creator>
	</item><item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634243</link>	
		<description>I also made use of the fact that Flash automatically builds an array called _root, which contains references to all items on the stage. So you don&apos;t need to create an array, as-long-as your clips have regular naming conventions (b0, b1, b2...).&lt;br&gt;
&lt;br&gt;
In AS, the following two lines of code yield identical results:&lt;br&gt;
&lt;br&gt;
_root.someMovieClip._width = 100;&lt;br&gt;
&lt;br&gt;
_root[&quot;someMovieClip&quot;]._width = 100;&lt;br&gt;
&lt;br&gt;
My approach would fall apart if the clips have haphazard names. But that problem could be easily solved with an programmer-generated array.&lt;br&gt;
&lt;br&gt;
Just add this declaration to the top:&lt;br&gt;
&lt;br&gt;
var arrClips:Array=new Array();&lt;br&gt;
arrClips = [&quot;a&quot;,&quot;q&quot;,&quot;xyz&quot;,&quot;blah&quot;]; //items are instance names of moviecliops&lt;br&gt;
&lt;br&gt;
Then change the following:&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; numclips; i++)br&gt; {&lt;br&gt;
_root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
to&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; arrclips.length; i++)br&gt; {&lt;br&gt;
arrClips[i].onRelease = playOthers;&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
and&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; numclips; i++)br&gt; {&lt;br&gt;
&lt;br&gt;
mc = _root[strPrefix + i];&lt;br&gt;
&lt;br&gt;
if (mc._name != this._name)&lt;br&gt;
{&lt;br&gt;
mc.gotoAndPlay(&quot;someFrame&quot;);&lt;br&gt;
} //end if&lt;br&gt;
&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
to&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &lt; arrclips.length; i++) {br&gt;
&lt;br&gt;
mc = arrClips[i];&lt;br&gt;
&lt;br&gt;
if (mc._name != this._name)&lt;br&gt;
{&lt;br&gt;
mc.gotoAndPlay(&quot;someFrame&quot;);&lt;br&gt;
} //end if&lt;br&gt;
&lt;br&gt;
} //end for&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634243</guid>
		<pubDate>Thu, 29 Jun 2006 11:44:34 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634253</link>	
		<description>&lt;strong&gt;Lord_Pall&lt;/strong&gt; Nope, I wasn&apos;t joking when I said non-programmer with the experience of a stunned chipmunk. I forgot to mention (I guess) that this is actionscript specific. &lt;br&gt;
&lt;br&gt;
&lt;strong&gt;grumblebee&lt;/strong&gt; neat, except I got this error:&lt;br&gt;
&lt;tt&gt;**Error** Scene=Scene 1, layer=actions, frame=1:Line 13: &apos;:&apos; expected&lt;br&gt;
     _root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
&lt;br&gt;
**Error** Scene=Scene 1, layer=actions, frame=1:Line 16: Unexpected &apos;}&apos; encountered&lt;br&gt;
     } //end function init&lt;br&gt;
&lt;br&gt;
Total ActionScript Errors: 2 	 Reported Errors: 2&lt;/tt&gt;&lt;br&gt;
&lt;br&gt;
and I don&apos;t quite understand everything you did, although I should  be able to figure it out, maybe. Thanks, can you explain the error to me, too?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634253</guid>
		<pubDate>Thu, 29 Jun 2006 12:01:40 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634297</link>	
		<description>Please, someone, explain how to fix it so the errors don&apos;t occur. I&apos;m beating my head against the wall here.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634297</guid>
		<pubDate>Thu, 29 Jun 2006 13:04:33 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634306</link>	
		<description>When you copied Grumblebee&apos;s code, did you copy the &quot;br&amp;gt;&quot; parts? &lt;br&gt;
&lt;br&gt;
Those shouldn&apos;t be there, they&apos;re an artifact of askMefi&apos;s HTML parsing.&lt;br&gt;
&lt;br&gt;
I don&apos;t know &quot;actionscript&quot; whatever that is, but judging from Grumblebee&apos;s code, &lt;br&gt;
&lt;br&gt;
The &quot;&apos;:&apos; expected&quot; comes from actionscript requiring a colon between a variable declaration and the variable (or function&apos;s) type, as in:&lt;br&gt;
&lt;br&gt;
for (&lt;b&gt;var i:Number&lt;/b&gt; = 0; i &amp;lt; arrclips.length; i++)&lt;br&gt;
&lt;br&gt;
or&lt;br&gt;
&lt;br&gt;
function &lt;b&gt;init():Void&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
The unexpected bracket just means you have one more close bracket (&quot;&lt;b&gt;}&lt;/b&gt;&quot;) than you have open brackets (&quot;&lt;b&gt;{&lt;/b&gt;&quot;).&lt;br&gt;
&lt;br&gt;
Carefully compare Grumblebee&apos;s code to your own, and make sure you have all the open brackets he has.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634306</guid>
		<pubDate>Thu, 29 Jun 2006 13:16:08 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: Lord_Pall</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634317</link>	
		<description>I&apos;m brain damaged.  I read grumblebees stuff as c++. It&apos;s actionscript and it&apos;s been a long week. &lt;br&gt;
heh</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634317</guid>
		<pubDate>Thu, 29 Jun 2006 13:21:21 -0800</pubDate>
		<dc:creator>Lord_Pall</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634322</link>	
		<description>Oh. I guess I am an idiot. Yeah, I copied the br&amp;gt; parts. Without them there I get no errors but I don&apos;t get anything else, either. I can click a movie till my finger falls off and it won&apos;t do jack. This is incredibly frustrating.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634322</guid>
		<pubDate>Thu, 29 Jun 2006 13:25:23 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: fishfucker</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634328</link>	
		<description>Are you referring to an actual frame in the following line? &lt;br&gt;
mc.gotoAndPlay(&quot;someFrame&quot;);&lt;br&gt;
&lt;br&gt;
Are your movie clip instances named correctly?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634328</guid>
		<pubDate>Thu, 29 Jun 2006 13:33:41 -0800</pubDate>
		<dc:creator>fishfucker</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634329</link>	
		<description>Well, work incrementally.&lt;br&gt;
&lt;br&gt;
You do have the clips set up, right, and they do have regular names, or if they don&apos;t, you&apos;ve declared an array with their names, right?&lt;br&gt;
&lt;br&gt;
First, write a function that just pops up a message box (or whatever). Get your click handler to call that function. &lt;br&gt;
&lt;br&gt;
Then figure out if you can get your click handler to pass an argument to the function (like a number, or a reference to the thing clicked).&lt;br&gt;
&lt;br&gt;
Then add the clip gotoandplaying business to that function that shows a message box. If that works, add the playing of the clicked clip.&lt;br&gt;
&lt;br&gt;
Just do one little piece at a time, don&apos;t try to do it all at once.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634329</guid>
		<pubDate>Thu, 29 Jun 2006 13:34:04 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634333</link>	
		<description>fishfucker, yup.&lt;br&gt;
&lt;br&gt;
orthogonality. I&apos;m slightly confused. If I have one movie clip and attached an event handler to it like this:&lt;br&gt;
&lt;code&gt;b1.onRelease = someFunction;&lt;/code&gt;&lt;br&gt;
when I click b1 that function will, um, function. But with grumblebee&apos;s code it looks like I don&apos;t have to write:&lt;br&gt;
&lt;code&gt;b1.onRelease = playOthers;&lt;br&gt;
b2.onRelease = playOthers;&lt;br&gt;
etc.&lt;/code&gt; That&apos;s all taken care of, isn&apos;t it?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634333</guid>
		<pubDate>Thu, 29 Jun 2006 13:39:33 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634336</link>	
		<description>so right now what I have looks like this:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
b1.onRelease = killthecook;&lt;br&gt;
&lt;br&gt;
//this works but it&apos;s stupid&lt;br&gt;
function killthecook() {&lt;br&gt;
	b2.gotoAndPlay(29);&lt;br&gt;
	b3.gotoAndPlay(29);&lt;br&gt;
	b4.gotoAndPlay(29);&lt;br&gt;
	b5.gotoAndPlay(29);&lt;br&gt;
&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
/* this is commented out because it wasn&apos;t working&lt;br&gt;
&lt;br&gt;
var numClips:Number = 5;&lt;br&gt;
var strPrefix:String = &quot;b&quot;;&lt;br&gt;
init();&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//assigns the function playOthers to the onRelease&lt;br&gt;
//event handler for each movieclip&lt;br&gt;
function init():Void {&lt;br&gt;
	for (var i:Number = 1; i &lt; numclips; i++) {br&gt;
		_root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
	} //end for&lt;br&gt;
&lt;br&gt;
} //end function init&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//makes each clip, except the one calling this function&lt;br&gt;
//gotoAndPlay&lt;br&gt;
function playOthers():Void {&lt;br&gt;
	var mc:MovieClip;&lt;br&gt;
	for (var i:Number = 1; i &lt; numclips; i++) {br&gt;
		mc = _root[strPrefix + i];&lt;br&gt;
		if (mc._name != this._name) {&lt;br&gt;
			mc.gotoAndPlay(29);&lt;br&gt;
		} //end if&lt;br&gt;
	} //end for&lt;br&gt;
} //end function playOthers&lt;br&gt;
*/&lt;br&gt;
&lt;/&gt;&lt;/&gt;&lt;/code&gt; sorry the indents didn&apos;t keep.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634336</guid>
		<pubDate>Thu, 29 Jun 2006 13:43:15 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634344</link>	
		<description>and those stupid &quot;br&amp;gt;&quot; got inserted by mefi. huh.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634344</guid>
		<pubDate>Thu, 29 Jun 2006 13:49:12 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item><item>
		<title>By: orthogonality</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634348</link>	
		<description>It&apos;s taken care of because Grumblebee&apos;s code &lt;i&gt;assigns&lt;/i&gt; playOther to each instance&apos;s onRelease handler:&lt;br&gt;
&lt;br&gt;
init();  // here Grumblebee CALLS init() &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
// here Grumblebee DEFINES init&lt;br&gt;
//assigns the function playOthers to the onRelease&lt;br&gt;
//event handler for each movieclip&lt;br&gt;
function init():Void&lt;br&gt;
{&lt;br&gt;
&lt;br&gt;
for (var i:Number = 0; i &amp;lt; numclips; i++) {&lt;br&gt;
_root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
// here the init function assign the function playOthers to the clip&lt;br&gt;
// Grumblebee&apos;s code requires that the clips be named strPrefix + i; &lt;br&gt;
// i is the number controlled by the for loop&lt;br&gt;
// strPrefix was previously defined by Grumblebee to be &quot;b&quot;&lt;br&gt;
&lt;br&gt;
} //end for&lt;br&gt;
&lt;br&gt;
} //end function init&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
In the actual Playothers function:&lt;br&gt;
Apparently, actionsctipt passes an implicit &quot;this&quot; reference. Grumblebee uses &quot;this&quot; to compare this._name to each clip&apos;s name, so as to not play the &quot;this&quot; clip.&lt;br&gt;
&lt;br&gt;
I don&apos;t see Grumblebee calling play on teh clicked clip, possibly because that&apos;s a default action in actionscript?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634348</guid>
		<pubDate>Thu, 29 Jun 2006 13:50:57 -0800</pubDate>
		<dc:creator>orthogonality</dc:creator>
	</item><item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634406</link>	
		<description>I ironed out some kinks and got it to work. I sent an example file to Grod. Here&apos;s the script from it:&lt;br&gt;
&lt;br&gt;
var numClips:Number = 4;&lt;br&gt;
var strPrefix:String = &quot;b&quot;;&lt;br&gt;
&lt;br&gt;
init();&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//assigns the function playOthers to the onRelease&lt;br&gt;
//event handler for each movieclip&lt;br&gt;
function init():Void&lt;br&gt;
{&lt;br&gt;
	for (var i:Number = 0; i &lt; numclips; i++) br&gt;
	{&lt;br&gt;
		_root[strPrefix + i].stop();&lt;br&gt;
		_root[strPrefix + i].onRelease = playOthers;&lt;br&gt;
	} //end for&lt;br&gt;
} //end function init&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
//makes each clip, except the one calling this function&lt;br&gt;
//gotoAndPlay&lt;br&gt;
function playOthers():Void&lt;br&gt;
{&lt;br&gt;
	init();&lt;br&gt;
	var mc:MovieClip;&lt;br&gt;
	for (var i:Number = 0; i &lt; numclips; i++)br&gt;
	{&lt;br&gt;
		mc = _root[strPrefix + i];&lt;br&gt;
		if (mc._name != this._name) mc.gotoAndPlay(&quot;go&quot;);&lt;br&gt;
	} //end for&lt;br&gt;
} //end function playOthers&lt;/&gt;&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634406</guid>
		<pubDate>Thu, 29 Jun 2006 14:44:44 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: grumblebee</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634411</link>	
		<description>Grod, if you need any more help, I might be able to work on it late tonight or tomorrow. But I will be offline until then (starting now). So I hope my post above helps. Good luck!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634411</guid>
		<pubDate>Thu, 29 Jun 2006 14:47:17 -0800</pubDate>
		<dc:creator>grumblebee</dc:creator>
	</item><item>
		<title>By: Grod</title>
		<link>http://ask.metafilter.com/41184/actionscript-help-for-a-non-programmer-who-wants-to-do-it-the-right-way#634461</link>	
		<description>Thanks! It works great.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41184-634461</guid>
		<pubDate>Thu, 29 Jun 2006 15:15:08 -0800</pubDate>
		<dc:creator>Grod</dc:creator>
	</item>
	</channel>
</rss>
