Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Flash - ActionScript

every other one

 
Jump to:  
 
bhnh
PostPosted: 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
PostPosted: Sat Jul 26, 2008 12:04 am    Post subject: Re: every other one
       
do you have a stop() on frame 1 of subClip?
 

 
bhnh
PostPosted: 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
PostPosted: 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.)
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

transport chorych Sennik newsy.bober.duu.pl koszulki apteka