Page 1 of 1

Color Changer Tutorial request

PostPosted: Mon Feb 13, 2012 6:18 am
by Spartan5015
Hey, I've been looking around a bit, but i havn't for the life of me found a way to change the colors of something in-game (like skin color) by using something similar to this:
Image

I've seen it done in several different ways on this site, and i was wondering if anyone could help me out by posting a tutorial?

Re: Color Changer Tutorial request

PostPosted: Fri Feb 17, 2012 12:18 am
by GoRepeat
Wierd.... the forums said .fla is not an allowed extension...

Anyway, I attached an example for you to look at. It is for AS2 and operates in the following manner:

1) the script on the main stage frame captures whatever color the mouse is currently hovering over and saves it in hex format as the variable _root.col
2) the rainbow (color selection) object is actually a button that on release sets _root.filler to equal _root.col; essentially, the user 'clicks' a color and it saves it the hex value into another variable
3) the object whose color is being changed actually has a mask for a filler with another blank/square object being masked
4) the masked object has a code snippet that sets the contained square's color to _root.filler

So, the mouse hovers over a color, saving it as _root.col, the user clicks the button, saving _root.col as _root.filler, the object has another enclosed object being masked, the masked object changes its color to match _root.filler.

User clicks, object changes color.

Click to Play
(Javascript Required)

ColorShiftExample.swf [ 2.48 KiB | Viewed 1929 times ]


Re: Color Changer Tutorial request

PostPosted: Fri Feb 17, 2012 12:20 am
by Spartan5015
Amazing. You're a life saver. thanks gore! :D

Re: Color Changer Tutorial request

PostPosted: Wed Feb 22, 2012 3:41 pm
by OwnerOfSuccuby
Thank you very much Gorepete !!! It is very good example.

Sorry had some problems with uploading *.fla - so it is *.zip archived :D

If some body use AS3 - it will be look like this one (little remake of AS2 Gorepete vesrion) :

Re: Color Changer Tutorial request

PostPosted: Wed Feb 22, 2012 3:44 pm
by BlueLight