<B>EDIT:</B> This will only work in Flash MX. You didn’t state what version you had. Hopefully it is MX, because if it isn’t, I can’t help you out. I don’t know Flash 5.
I’m not all that sure what it is you’re trying to do. Perhaps if you both could explain it a little more to me, I could provide a 5.0 translation for LIB’s MX method.
Well… I suppose there are a number of ways that could be done. Personaly, I’d use a “for. . . in” loop or maybe just a function.
for in loops detect all of something in something else, but I haven’t gotten them to work correctly, all of the time, on movie clips yet… we’ll see how this code works.
function colormall(){
myColor = Math.round (Math.random()*0xFFFFFF);
for(mc in _root){
myColoredObject = new Color (mc);
myColoredObject.setRGB(myColor);
}
}
can’t tell if that will work yet… but then you would just place the following on ONE of the clips… not all of them.
onClipEvent(enterFrame){
_root.colormall();
}
The problem with this as I see it is that it will set any movie clip that’s on the stage… including those that you might not want to have set.
Well, you don’t really need to run that enterFrame, do you?
Basically, what you have to do is get that color out of the movie clip, on the _root for instance:
_root.myColor=...
If you don’t want to do that, and that you have clips clip1 and clip2, you can call clip1’s color from clip2 (assuming that they are at the same depth):
myColoredObject = new Color (this);
myColoredObject.setRGB(_parent.clip1.myColor);
You’d have to put that in a handler of clip2 of course.
We need mind-readers… I just wanted to say that with the original piece of code, the variable myCol is located inside the movie clip, so if you want to access that variable, you can either put it in the _root so that the second clip can call the same variable, _root.myCol.
Or clip2 can access the variable directly inside clip1 with the right path.
Wow, very nice random color fade Ilyas. I worked out the same effect, but to nowhere near the effeciency of your code. I am using that from now on when I need to
woH! people. thanks for the help!
(i had to read each posts about good twenty times to understand what you guys were talking about. okay, FINE. i lied. about fourty times…
i’m at work right now, but i’m gonna try mr.Ilya’s coding when i get home. the one with “_parent.mc1” thing.
oh yeah, Mr. Ilyas, btw, what is it mean by:
(assuming that they are at the same “DEPTH”):
that was your first post, i think. Is that the length of mc?
oh, boy. i can’t wait to come up with other questions to ask you guys to solve. haha. just kidding.