|  | every other one |  | |
| | | bhnh |  |
| Posted: Fri Jul 25, 2008 11:08 pm Post subject: every other one |  |
OK, let's say I've got a single-frame MovieClip named "TheClip". In the clip is a two-frame nested MovieClip named "subClip". I place 10 instances of TheClip on the Stage:
for(var k:Number=0;k<10;k++){ attachMovie("TheClip","TheClip"+k, k,{_x:10, _y:k*20});
So far, so good. Now, I'd like the subClip of every other TheClip to go to and stop on frame 2. I try this:
if (k % 2 == 0){ this["TheClip"+k].subClip.gotoAndStop(2); }
... and all the subClips go to frame 2.
I'm missing something very obvious here, I know. Any pointers? Many thanks in advance. |
| |
| | | kglad |  |
| Posted: Sat Jul 26, 2008 12:04 am Post subject: Re: every other one |  |
| do you have a stop() on frame 1 of subClip? |
| |
| | | bhnh |  |
| Posted: Sat Jul 26, 2008 11:12 am Post subject: Re: every other one |  |
Many thanks for the prompt response, kglad. Yes, the subClip does have a "stop()" in frame 1. I subsequently learned that the issue can be resolved simply by assigning a variable to the the attachMovie procedure. The following does the trick...
for(var k:Number=0;k<10;k++){ var TC:MovieClip = attachMovie("TheClip","TheClip"+k,k,{_x:10, _y:k*20}); if(k%2 == 0){ TC.subClip.nextFrame(); } } |
| |
| | | kglad |  |
| Posted: Sat Jul 26, 2008 2:01 pm Post subject: Re: every other one |  |
| you're welcome. (and your reference to "this" must have been incorrect.) |
| |
|
|