Affecting all instances of a movieclip

Hey.
I’ve got a site where all of the graphical elements are made to be movieclips because I had something like the following in mind.

Would it be possible through actionscript to change all instances of a movieclip? Let’s say I pull the movieclip from a sharedLib.swf which also contains all my fonts, could I somehow change the color of the main clip so that all the instances updates themselves even though they may reside in different swf’s?

I’mhoping this is the case as it would be cool to create some sort of skinning system for the site.

-M

http://forums.ultrashock.com/forums/showthread.php?s=&threadid=23018

Ok… I had a hard time following that one, but if I’m getting it right the answer was in this post

good place to use ASBroadcaster. in that movieclip that needs to be changed, you would throw in its first frame something like:

Stage.addListener(this);
this.onChangeBGColor = function(hex){
new Color(this).setRGB(hex);
}

then whenever you need to change the colors of all the instances of that clip use:

Stage.broadcastMessage(“onChangeBGColor”, 0xff0000);

and all those clips will change to red… or whatever color you pass.

This example is using the Stage object just because its a global and is already ASBroadcaster initiated, though you could just as well make your own, or even use the Mouse or Key object as well.

…right? I’ll try it out and check in here whether it helped.

Thanks Senocular. :slight_smile:

-M

Awesome! Sen, do yo mind if I (or someone else) writes a tute about that?

[size=1]Also, can someone rate this thread?[/size]

I sure wouldn’t mind if someone did. :slight_smile:

-M

If you’re unfamiliar with ASBroadcaster, you can read this:
http://www.umbc.edu/interactive/flash/tutorials/showpage.php?p=ASBroadcaster

In that thread I mentioned the clip could add itself in its first frame, but, should that be troublesome, you can certainly add it outside of that with Stage.addListener(some_mc); etc