Colour Change - All at once... [MX]

I’m working on creating a feature where you can change the colour-scheme of a website by clicking on certain buttons. However, it’s very limited if I work using the basic code provided in the AS colour change tutorial (which I did a little while back).

Anyway, I’ve created a function for this which I am about to test out but even with the function (the way I created it) I would still have to set the onPress of the buttons (I’m doing all the AS in a frame on the main timeline as a pose to on the buttons) to change every individual movie clip that I want to change the colour of…

So, I don’t know how I could make this easier but I was thinking that creating an array containing those movieclips that I want to change the colour of and then using AS to get Flash to change the colour of every movieclip in the array might work.

I’m not sure how I would do this or if it would work. Could somebody help me out please?

Any advice is much appreciated. Thanks,
JK.

this is a nice lil function to change the colors easy and fast all at once…

first of all, every mc with an color on it, should have several frames with different colors, lets say, red green and blue…

label the frames like that…

now, with the button, add this lil action


on(release){
	changeColor("X");
}

where X is the frame label…

now we know to wich frame every mc should go to… but how do we change them all at once…


MovieClip.prototype.change = function(x){
	this.gotoAndStop(x);	
}
changeColor = function(x){
	mc1.change(x)
	mc2.change(x)
	mc3.change(x)
	mc4.change(x)
	mc5.change(x)
	mc6.change(x)
	mc7.change(x)
	mc8.change(x)
}

add that code on the first frame, so now, when you click the button, lets say the button that says RED, the mc’s 1 to 8 will go to the frame called RED… :slight_smile:

to add more mc’s, just give them an instance name, make them have multible colors and label the frames, then add the mc’s instance name to that list…

and tadaa, this is the result: (check .fla)

see

http://www.flashkit.com/board/attachment.php?s=&postid=2425642

which is from post
http://www.flashkit.com/board/showthread.php?s=&threadid=460380

RvGate, that is a possible solution but creating frames within the movieclips and entering in all that code would actually take longer than my method lol.

Sen, I’m taking a look at the .fla now and I will get back to you :).

Thanks,
JK.

By “all that code” I mean the instance names of every movie clip. Using my original method (which I thought was inefficient), I can do the same thing but I don’t need to create new frames within each movie clip for the different colours.

If you wish, I will post my function (which I am going to convert into a prototype [hopefully :)] in a moment).

JK.

you dont have to use frames and labels, there are other ways to do this, with the same function…

like you did with your color changer, if you ad that script into the prototype handler, if will have effect on all the mc’s given in that list…

there’s not really an other way to do it, you always keep tracking down the mc’s were you need to change your colors…

if you give me ur code, i will impliment it into mine for full functionality

Sen, the code used there is a little over the top for what I’m intending to achieve. I will do it using my inefficient way (which actually seems very similar to the way that circles effect is done - although, I didn’t spend hours looking at the script) and see how it goes. I’m convinced that there is an easier way to do this (perhaps adding all the movie clips to an array…) but I don’t know what it is.

RvGaTe, thanks but no thanks :). Your code follows the same idea as my original code - meaning that there is no real need to implement my .fla using your code.

But ty very much for the offer :thumb:. I will post up the finished colour-change bit in a day or two (because I’m having trouble with another part of the website and need to fix it).

Thanks again,
JK.

np…