-
changing class attributes
Suppose I have a movie clip in my library called circle_mc...and its just a big red circle. Dragging it to my canvas creates an instance of it...and then I can give it an instance name. Now, supposed I create a copy of this "myCircle" object, and paste it on a new layer...now I have two myCircle objects both of class circle_mc. I noticed if I do this in actionscript (on the timeline)
myColor = new Color(myCircle);
myColor.setRGB(0x000000);
then only ONE of the circles changes to black...I need to know how to edit the actual CLASS color attribute, so that both myCircle instances are updated. Anyone know how to do that?? thanks!
-
Senior Member
the easiest way would be to name the instances myCircle0, myCircle1 etc... and then use a loop to change all of them,
code:
var myColor;
for (var i = 0; i < N; ++i) {
myColor = new Color(this["myCircle" + i]);
myColor.setRGB(0x000000);
}
where N is 1 higher than the highest number used in naming your circles (that is N is the number of circle movie clips).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|