Re: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Ing. Mario Falomir
oops I missed paste it complete... var totalMovieClips:Number = 3; for ( var i = 0; i < totalMovieClips; i ++ ) { _root['mc' + i].indexPos = i; _root[ 'mc' + i ].onRelease = function() { trace( 'mc' + this.indexPos + ' onRelease' ); } _root[ 'mc' + i ].onRollOver = fu

Re: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Alejandro Diaz
Thanks guys! I was cracking my head over this one (lack of sleep didn't help much), and of course, figures that right around the time I send this question I stop receiving all emails from Flashcoders (did it break for anyone else?). Anyways, great help and pointers and I will experiment with these

RE: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Keith Reinfeld
Ryan, Absolutely. That's how I've handled things on my homepage. The answer I suggested to Alex was an effort to stay on point with regard to his question. I would also recommend that he set up named functions outside his buttonBehavior function. It may not be necessary for his current pr

Re: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Ing. Mario Falomir
Hi Alex, here is an example that could help you and illustrate how to accomplish what you want var totalMovieClips:Number = 3; for ( var i = 0; i < totalMovieClips; i ++ ) { _root['mc' + i].indexPos = i; _root[ 'mc' + i ].onRelease = function() { trace( 'mc' + this.indexPos +

RE: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Ryan Potter
loadMovie(this.href, "load_target"); } } } buttonBehavior(); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith Reinfeld Sent: Thursday, March 30, 2006 5:11 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcod

RE: [Flashcoders] Counter in function assigned inside a for loop

2006-03-31 Thread Keith Reinfeld
Try this Alex, function buttonBehavior():Void { for (var i=1; i < 8; i++) { //do tmpMC = _root["mb_"+i]; just once per loop //to save processing var tmpMC:MovieClip = _root["mb_"+i]; tmpMC.onRollOver = function() {