Color Changer Tutorial request

A place for tutorials on how to get the most out of Flash

Color Changer Tutorial request

Postby Spartan5015 » Mon Feb 13, 2012 6:18 am

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?
User avatar
Spartan5015
 
Joined: Mon Aug 01, 2011 9:54 pm
Location: nowhere, and everywhere all at the same time.

Re: Color Changer Tutorial request

Postby GoRepeat » Fri Feb 17, 2012 12:18 am

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 1890 times ]

Attachments
ColorShiftExample.fla.zip
(21.03 KiB) Downloaded 50 times
Picarto LiveStream: https://picarto.tv/GoRepeat
Other Stuff: Click Here
User avatar
GoRepeat
Moderator
 
Joined: Wed Jul 21, 2010 2:26 am
Location: Behind the Looking Glass

Re: Color Changer Tutorial request

Postby Spartan5015 » Fri Feb 17, 2012 12:20 am

Amazing. You're a life saver. thanks gore! :D
The more you sweat in practice the less you bleed in battle.
User avatar
Spartan5015
 
Joined: Mon Aug 01, 2011 9:54 pm
Location: nowhere, and everywhere all at the same time.

Re: Color Changer Tutorial request

Postby OwnerOfSuccuby » Wed Feb 22, 2012 3:41 pm

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) :
OwnerOfSuccuby
 
Joined: Fri Jun 11, 2010 9:33 pm

Re: Color Changer Tutorial request

Postby BlueLight » Wed Feb 22, 2012 3:44 pm

User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am


Return to Tutorials



Who is online

Users browsing this forum: No registered users