HOME | DD
Published: 2010-12-12 05:07:02 +0000 UTC; Views: 24069; Favourites: 311; Downloads: 434
Redirect to original
Description
As I was making dress up games, I was suggested to try using color pickers for changing colors instead of a button that only goes through a limited selection of colors. Unfortunately, Actionscript 2.0, did not have such a thing as a color picker, so I was left with googling and downloading color pickers made by other people that supported that version. I wanted to try Actionscript 3.0 which supported this, but I had to pretty much relearn my actionscript to make dressups work and it was far from easy as I hadn't seen any tutorials for dressups with Actionscript 3.0!As I was making dressups for the pokemon fifth-generation, I finally put one together using this version. , and others wanted a tutorial in making dressups with color changers. I have procrastinated enough and finally was able to produce a somewhat less confusing tutorial than my other ones I hope ^_^;
Note: I have copied the code I used for the tutorial below, but the drag and drop part of the code only works if you have an object called "santahat" in your project!
Needless to mention, you should have some basic familiarity with Flash to use this tutorial. Constructive feedback welcome as always! ^_^
COLOR CHANGING
import fl.controls.ColorPicker;
import fl.events.ColorPickerEvent;
import flash.geom.ColorTransform;
var BodycolorInfo:ColorTransform = Body.transform.colorTransform;
cpBody.addEventListener(ColorPickerEvent.CHANGE, colorChange);
BodycolorInfo.color = cpBody.selectedColor;
Body.transform.colorTransform = BodycolorInfo;
function colorChange(e:Event):void
{
BodycolorInfo.color = cpBody.selectedColor;
Body.transform.colorTransform = BodycolorInfo;
}
DRAG & DROP
santahat.buttonMode = true;
santahat.addEventListener(MouseEvent.MOUSE_DOWN, hatPickUp);
stage.addEventListener(MouseEvent.MOUSE_UP, hatDropIt);
function hatPickUp(e:MouseEvent):void
{
santahat.startDrag();
}function hatDropIt(e:MouseEvent):void
{
santahat.stopDrag();
}
Related content
Comments: 154
pichu90 In reply to LexieSkye [2012-04-11 05:28:40 +0000 UTC]
This I would put in a layer separate from all other objects, along with all color picking code and button actions like reset and item selection :3
👍: 0 ⏩: 0
AskPonySouthAfrica [2012-03-01 04:58:29 +0000 UTC]
((this is really helpful, thankyou for making the tutorial! ^U^))
👍: 0 ⏩: 0
pichu90 In reply to startheeevee1 [2012-01-17 04:35:02 +0000 UTC]
Hard to make a dressup with paint
👍: 0 ⏩: 2
Hatty-hime In reply to pichu90 [2012-03-07 06:33:38 +0000 UTC]
This is random, but LOL. Was just browsing through and this made me lose it.
👍: 0 ⏩: 0
azamono In reply to ??? [2012-01-06 14:32:43 +0000 UTC]
You saved my homework lol. THANKS <3
👍: 0 ⏩: 0
pansage3010 In reply to ??? [2011-10-14 18:20:03 +0000 UTC]
do you know how to add music to a dress up game?
👍: 0 ⏩: 1
pansage3010 In reply to pichu90 [2011-10-17 14:49:50 +0000 UTC]
please can you make a tutorial on how to add music then?
👍: 0 ⏩: 1
Snowdrop-The-Glaceon [2011-08-19 14:35:15 +0000 UTC]
1.cover your mouth 2.make a wish 3.put hand to heart 4.copy and paste this to 15 games in one day. 5. tommarow will be the best day of your life.it acutally works.
👍: 0 ⏩: 0
Kittymuffins98 In reply to ??? [2011-07-28 17:56:04 +0000 UTC]
I need help I keep getting Compiler Errors!
👍: 0 ⏩: 1
pichu90 In reply to Kittymuffins98 [2011-07-29 05:14:33 +0000 UTC]
What kind of error exactly? ^^
👍: 0 ⏩: 1
pichu90 In reply to caykie [2011-07-17 04:24:28 +0000 UTC]
I may be late in explaining this, but you have to repeat the process for each individual object (like fur color, tail color, etc with different names for each color picker, colorInfo object and item of course ^^
👍: 0 ⏩: 1
rice-chex In reply to ??? [2011-06-24 06:44:27 +0000 UTC]
This is great! so how do you change the color for more than one object? Do I need to create a new layer for each object? And should I copy/paste the entire code for each one, except for the new symbol names?
👍: 0 ⏩: 1
pichu90 In reply to rice-chex [2011-07-01 05:27:54 +0000 UTC]
For changing colors, that would be a good idea and the code could actually go in one layer separate from all the other objects. I don't suppose it would hurt to separate for each layer though ^-^
👍: 0 ⏩: 0
Miphica [2011-06-19 20:24:22 +0000 UTC]
I started out and went to the components menu, but all it has on it are User Interface and Video.
How do you get the Color Picker option?
👍: 0 ⏩: 1
pichu90 In reply to Miphica [2011-06-20 06:59:47 +0000 UTC]
Go to the Actions menu, find the Actionscript drop-down menu and select Actionscript 3.0. You can also get this if you set the publish settings in Flash to 3.0. Let me know if you have problems ^^
👍: 0 ⏩: 1
pichu90 In reply to BlueTheKitten [2011-05-22 23:42:03 +0000 UTC]
The color picker I think you mean? It was made by another programmer that I put into the Flash components :3
👍: 0 ⏩: 0
Sutehani [2011-04-03 00:44:54 +0000 UTC]
So, I'm trying to do my own dress up with shading. Not black/color/white, but tints and shades of the color.
And I saw in Victini's, that you do include tint shading to the color picked. However, I cannot figure out how you did this.
Any advice?
👍: 0 ⏩: 1
pichu90 In reply to Sutehani [2011-04-04 01:34:28 +0000 UTC]
It's a tad more complicated than can be explained here but the basic idea is having a second layer with the overlay setting and the first layer is a greyscale version of the original. The color picker changes the color of the overlay layer on top, so it changes the color of the object w/shading more easily. That's a start I hope ^^'
👍: 0 ⏩: 1
Sutehani In reply to pichu90 [2011-04-04 02:34:27 +0000 UTC]
I wound up finally figuring it out myself. I didn't name the instance, but I named the MC, so that was my problem.
Now to figure out how to make something "active" to change it's color
👍: 0 ⏩: 0
pichu90 In reply to Dragite42 [2011-03-31 04:41:02 +0000 UTC]
Doesn't drag/drop at all or compiler error?
👍: 0 ⏩: 0
00jolty In reply to ??? [2011-03-05 22:24:03 +0000 UTC]
I've got it working, but for some reason it makes all of my objects start off black instead of their original colour. Can you please help me figure out what I've done wrong?
👍: 0 ⏩: 1
pichu90 In reply to 00jolty [2011-03-07 01:09:06 +0000 UTC]
Try to set the color picker's color to something other than black ^^
👍: 0 ⏩: 0
chanxbunn [2011-01-19 15:52:03 +0000 UTC]
ive problem...help D: i paste codes for drag and drop...if one not worked i tryed yourzz but nothing want drag...or drop .q.
👍: 0 ⏩: 1
1 | Next =>




















