Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Color Wheel Code Sample

by Administrator on ‎04-21-2011 04:45 PM - edited on ‎04-21-2011 04:45 PM by BlackBerry Development Advisor (4,056 Views)

The community of this developer forum has been among one of the best i've ever been apart of.  Kudos to you all who have been instrumental in its upbringing.

 

As a token of my appreciation, i'd like to offer some code from my own library, which hopefully some will find useful.

 

Attached is my ColorWheel class that creates a vector graphic of the color spectrum, with or without gradating lightness.  i plan on publishing it as recipe on the Adobe® Developer CookBooks site in the coming weeks with a detailed explanation, but since i haven't written that yet i'll simply post the code here and offer answers to any questions.

 

 

 

Here is an example on the use of these classes, which are available for download below.

Screen shot 2011-04-14 at 4.50.18 AM.png

 

 

package
{
//Imports
import com.mattie.utils.colorUtils.ColorWheel;
import com.mattie.utils.colorUtils.ColorWheelQuality;
import flash.display.Sprite;

//SWF Metadata Tag
[SWF(width="1024", height="600", frameRate="30", backgroundColor="#FFFFFF")]

//Class
public class Main extends Sprite
{
//Variables
private var rad:uint = stage.stageWidth / 6;

//Constructor
public function Main()
{
init();
}

//Initialize
private function init():void
{
var colorWheel:ColorWheel = new ColorWheel(rad, ColorWheelQuality.LOW, NaN);
colorWheel.x = rad;

var whiteWheel:ColorWheel = new ColorWheel(rad, ColorWheelQuality.LOW);
whiteWheel.x = rad * 3;

var blackWheel:ColorWheel = new ColorWheel(rad, ColorWheelQuality.LOW, 0);
blackWheel.x = rad * 5

colorWheel.y = whiteWheel.y = blackWheel.y = stage.stageHeight / 2;

addChild(colorWheel);
addChild(whiteWheel);
addChild(blackWheel);
}
}
}

 

 

 


Users Online
Currently online: 11 members 617 guests
Please welcome our newest community members: