HOME | DD

pichu90 — Flash Actionscript 3 Tutorial

Published: 2010-12-12 05:07:02 +0000 UTC; Views: 23004; 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

chanxbunn In reply to ??? [2011-01-20 14:10:11 +0000 UTC]

sry xDDDDD i seen many tutorials about drag and drop.i paste the code in action frame^^,but it not worked.....so i looked at other tutorials...different codes...but they dont work too...i dont change smth on the codes,but why???

👍: 0 ⏩: 0

grapejuice88 [2011-01-03 05:16:23 +0000 UTC]

I really wanna try XD
this works on Macbook too, right?

👍: 0 ⏩: 1

pichu90 In reply to grapejuice88 [2011-01-04 05:11:21 +0000 UTC]

Should, as long as you use AS 3 ^^

👍: 0 ⏩: 0

beebarb [2010-12-18 04:15:57 +0000 UTC]

Nicely done

👍: 0 ⏩: 1

pichu90 In reply to beebarb [2010-12-23 06:37:47 +0000 UTC]

Thank you :3

👍: 0 ⏩: 1

beebarb In reply to pichu90 [2011-01-08 05:30:07 +0000 UTC]

You're welcome

👍: 0 ⏩: 0

Deruuyo In reply to ??? [2010-12-15 15:47:03 +0000 UTC]

Pichu, i just do whatever you wrote on this flash, but when i copy the code you write on this flash's description box to the action-frame, that is'nt work
i got an error message =_="
How about if you try to copy those code on this description box too and put it on the flash, maybe you will got an error too...

👍: 0 ⏩: 2

pichu90 In reply to Deruuyo [2010-12-15 17:11:20 +0000 UTC]

Which code is this a problem?

I realize there may be one thing I forgot to mention is to check that "Actionscript 3.0" must be selected on the left side on the "Actions" tab. It might be saying "Actionscript 1.0/2.0" ^^

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-15 17:22:32 +0000 UTC]

No,no, that is fix already ^^", sorry, now i send you a note, i want to know how to add a code for multiple object ^^

👍: 0 ⏩: 0

Deruuyo In reply to Deruuyo [2010-12-15 16:08:03 +0000 UTC]

Oh, no, no, it is finally work
My fault is i not write the Body and cpBody with capital word on B ^^"
sorry

👍: 0 ⏩: 0

Deruuyo In reply to ??? [2010-12-13 07:35:39 +0000 UTC]

Daaw, finally !!! thank you so much 1000x
I will try my best !!

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-13 08:48:52 +0000 UTC]

You're so welcome! I hope it is helpful too

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-14 12:01:23 +0000 UTC]

Thanks it's so helpfull , anyway, do we must use an action script to create an animation too ^^ ?

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-15 04:43:31 +0000 UTC]

You're welcome

Not necessarily, but sometimes I use actionscript when making more complex animations :3

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-15 05:26:49 +0000 UTC]

Oh ^^ i see, is that right to smooth our animation we must use tween animation ?

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-15 09:52:26 +0000 UTC]

Not necessary, but it makes it easier to smooth that way :3

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-16 04:37:31 +0000 UTC]

^w^ on the next grade on my school we will learn animation on computer lesson
after i create dress up game can i learn how to animate something at you too ^w^ ?
not mean to force you

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-16 05:33:15 +0000 UTC]

Oh cool

Animation is easier to make in Flash, I'm still working with it too :3

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-16 05:49:48 +0000 UTC]

About your Caipirinha Pichu (hope i not wrong spell it XD) do you use action script too ?

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-16 09:29:56 +0000 UTC]

yes i can show you the file if you are interested :3

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-16 16:58:56 +0000 UTC]

Daaaw ? really ??
What a pleasure for me
you can send it to my e-mail absolugia@ymail.com

Daaw, thank you so much for this

👍: 0 ⏩: 1

pichu90 In reply to Deruuyo [2010-12-17 19:18:54 +0000 UTC]

And there you go!

👍: 0 ⏩: 1

Deruuyo In reply to pichu90 [2010-12-18 10:08:51 +0000 UTC]

@!@$@#$!@#$!@~!~!~~~~~~


*faint*

👍: 0 ⏩: 0

feline-soul In reply to ??? [2010-12-12 23:04:04 +0000 UTC]

This is awesome!!! It can definitely help me out with my projects!!!

👍: 0 ⏩: 1

pichu90 In reply to feline-soul [2010-12-13 08:48:58 +0000 UTC]

Hope so!

👍: 0 ⏩: 0

Lunar-Wind In reply to ??? [2010-12-12 22:13:32 +0000 UTC]

Ohhh! I've been wondering how you made those color pickers! I was able to do something similar in AS 2.0 but I had to individually create each color and frame. xD

Thank you so much for making this. ilu ;u;

👍: 0 ⏩: 1

pichu90 In reply to Lunar-Wind [2010-12-13 08:49:06 +0000 UTC]

You are welcome ^^

👍: 0 ⏩: 0

Pikacshu In reply to ??? [2010-12-12 16:05:07 +0000 UTC]

cool, i already knew how to do that btw xD but is a big help for others

👍: 0 ⏩: 1

pichu90 In reply to Pikacshu [2010-12-13 08:49:25 +0000 UTC]

great that you know how to do this ^^

👍: 0 ⏩: 0

caykie In reply to ??? [2010-12-12 15:44:52 +0000 UTC]

Nice tutorial, is it just me or is it really confusing? o-o

👍: 0 ⏩: 1

pichu90 In reply to caykie [2010-12-13 08:49:36 +0000 UTC]

It might be a bit technical

👍: 0 ⏩: 1

caykie In reply to pichu90 [2010-12-14 02:45:19 +0000 UTC]

and im very stupid o-o you got a skype? xD

👍: 0 ⏩: 1

pichu90 In reply to caykie [2010-12-14 03:28:37 +0000 UTC]

nope

👍: 0 ⏩: 1

caykie In reply to pichu90 [2010-12-14 22:10:37 +0000 UTC]

okiess, thanks anyways~

👍: 0 ⏩: 0

pichu318 In reply to ??? [2010-12-12 15:38:49 +0000 UTC]

When you got your new program did you get it free or just a trial, or did you buy it?

👍: 0 ⏩: 1

pichu90 In reply to pichu318 [2010-12-13 08:49:51 +0000 UTC]

I started with a trial and then got the full version

👍: 0 ⏩: 0

00jolty In reply to ??? [2010-12-12 06:33:32 +0000 UTC]

Ohh yay, thanks. I've been trying to figure out how to make colour pickers for quite a while.

👍: 0 ⏩: 1

pichu90 In reply to 00jolty [2010-12-13 08:50:01 +0000 UTC]

You're welcome

👍: 0 ⏩: 0

AlyTheWolf In reply to ??? [2010-12-12 05:45:51 +0000 UTC]

omg O_O THAAANK YOOOU I've been looking for one of these!!! -crying-

👍: 0 ⏩: 1

pichu90 In reply to AlyTheWolf [2010-12-13 08:50:09 +0000 UTC]

You are very welcome

👍: 0 ⏩: 0

Sparks178 [2010-12-12 05:34:28 +0000 UTC]

._.

For the record, I hate using code now.

👍: 0 ⏩: 0

R777man In reply to ??? [2010-12-12 05:19:00 +0000 UTC]

Hmmmm I should show Coshi this one ^^

👍: 0 ⏩: 1

pichu90 In reply to R777man [2010-12-13 08:50:26 +0000 UTC]

Cool ^^ Hope he can use it ^^

👍: 0 ⏩: 0

MildDestruction In reply to ??? [2010-12-12 05:15:53 +0000 UTC]

If i ever get/use flash ill take this tutorial!

👍: 0 ⏩: 1

pichu90 In reply to MildDestruction [2010-12-13 08:50:32 +0000 UTC]

Great

👍: 0 ⏩: 1

MildDestruction In reply to pichu90 [2010-12-13 22:16:38 +0000 UTC]

Yup!

👍: 0 ⏩: 0

WaterBlizzard In reply to ??? [2010-12-12 05:14:59 +0000 UTC]

Thank you so much, Pichu~ XD

👍: 0 ⏩: 1

pichu90 In reply to WaterBlizzard [2010-12-13 08:50:38 +0000 UTC]

You're very welcome :3

👍: 0 ⏩: 0

LIUKANG08 [2010-12-12 05:14:49 +0000 UTC]

just one question how sparks could stay still all the tutorial?

👍: 0 ⏩: 1

pichu90 In reply to LIUKANG08 [2010-12-13 08:50:56 +0000 UTC]

With candy, lol.

👍: 0 ⏩: 0


<= Prev | | Next =>