CREATING SIMPLE PAINT APPLICATION USING COLORTRANSFORM CLASS

Hey guys,

This is my third post on my blog, and i am going to try my ideas share with you related to some development things. I hope it helps to you understand the different concept & topics which I will post one by one as my available time.

So, Lets come to the topic. Here I have a created simple application using ColorTransform class. This post will teach you how to use the class. Using this class you will be able to apply a single color tint to any object at any time. The example below uses this class to change the color of the object when the corresponding color you pickup from color picker Objects(MovieClips).



Here is the code:
[as3]
// Creating Simple Paint Application
// Document class
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.ColorTransform;
import flash.ui.Mouse;

public class colorapp extends MovieClip{

// Define Array for color pickers
private var colorPickers:Array;
// Set the color array
// And set all colors respectively
private var colorList:Array = new Array(0xCC9900,
0xFFFF99,
0xCC99CC,
0xFF9932);

// Define current color variable
private var currentColor:ColorTransform = new ColorTransform();

//Constructor
public function colorapp():void{

// Move bursh MovieClip acording to mousepointer
this.addEventListener(Event.ENTER_FRAME, moveBrush);

// Hide mouse pointer
Mouse.hide();

// Put all color picker MovieClips into the array
colorPickers = new Array(mcPickerBrown,
mcPickerYellow,
mcPickerPink,
mcPickerOrange);

// Setting up color picker’s shades & assigning mouse events
for(var i:Number = 0; iDownload Source [colorapp.zip]

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *