View Full Version : childs gotoAndPlay random frame??
Guig0
February 28th, 2003, 12:44 PM
how can i make all mcs (a bunch of them) inside another mc, to gotoAndPlay in a random frame without having to adress each one of them by theyr instance names?
wild guess: a for loop?
Anyone?
Thanks =)
pom
February 28th, 2003, 12:45 PM
A for..in loop :)
It's explained in the AS tricks... :trout:
Guig0
February 28th, 2003, 12:46 PM
i knew i forgot to search somewere (-:
thanks Ilyas, youŽre pretty fast ;)
pom
February 28th, 2003, 12:49 PM
Yeah baby... :cowboy:
Guig0
February 28th, 2003, 12:58 PM
hehe..
so just to clarify... if i want that all movies inside the ilyas mc on the root, to gotoAndPlay a random frame, iŽll have to use a for in loop like this:
for (mc in _root.ilyas){
gotoAndPlay(random());
}
right?
pom
February 28th, 2003, 01:03 PM
More or less (careful with the syntax and the values returned by Math.random() though...). And you have to be careful that there are only those movie clips inside ilyas. Otherwise, you'll have to test it:
for (mc in _root.ilyas){
_root.ilyas[mc].gotoAndPlay(random(20)+1);
}at least, and
for (mc in _root.ilyas){
if (_root.ilyas[mc] instanceof MovieClip)
_root.ilyas[mc].gotoAndPlay(random(20)+1);
}would be better (not sure of the syntax though).
pom :bandit:
Guig0
February 28th, 2003, 01:13 PM
thank you bery buch! (i got the floo ;) )
another thing...
what is pom? :P
seriously... what is pom :q:
and you may loose the message on you status... i gave up :( she blew me off completly...
lostinbeta
February 28th, 2003, 01:17 PM
It means potatoe right? I think I remember you telling me that Ilyas.
Guig0
February 28th, 2003, 01:18 PM
...but why potatoes??
pom
February 28th, 2003, 01:18 PM
I feel sorry for you guig0, I really do... Ah, women...
And pom, well, that some sort of a nickname I guess. It's actually a shortage of my email address, which is actually a *bad* joke, so don't expect me to explain that :evil:
Guig0
February 28th, 2003, 01:23 PM
women are bad, BAD!! that goes for you kitty :bad:
about the nick, i understand ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.