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

PikaIsCool In reply to ??? [2010-12-12 05:12:22 +0000 UTC]

FF ;~; i dont have flash anymore....

👍: 0 ⏩: 1

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

:<

👍: 0 ⏩: 0

Ambunny In reply to ??? [2010-12-12 05:09:33 +0000 UTC]

Very useful, thank you so much! <3

👍: 0 ⏩: 1

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

You're welcome, hope is easy enough to understand ^^

👍: 0 ⏩: 0


<= Prev |