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

2006-03-31 Thread Ryan Potter
- 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: [Flashcoders] Counter in function assigned inside a for loop Try this Alex, function buttonBehavior():Void { for (var i=1

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 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

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

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 =

[Flashcoders] Counter in function assigned inside a for loop

2006-03-30 Thread Alejandro Diaz
Heya guys, I am assigning the button behaviors to a set of movieclips through a for loop, however, I am coming up against something where I know what is happening, but don't know how to fix it. Basically, inside that for loop I assign each of the button behaviors as a function but I don't know