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

Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Color Wheel – code offering

[ Edited ]

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.


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



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")]

public class Main extends Sprite
	private var rad:uint = stage.stageWidth / 6;
	public function Main()
	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;


class files are attached.  enjoy!


[EDIT]  by the way, if any of you brilliant developers have any suggestions on how to make the class better, more efficient, i'm all ears.  would love to hear from you.

PlayBook Applications:
Drop Swatch
Posts: 265
Registered: ‎01-02-2011
My Device: Z30, PlayBook
My Carrier: AT&T

Re: Color Wheel – code offering



Meetup for BlackBerry 10
Meetup Search Tool - not available at the moment
Posts: 96
Registered: ‎01-20-2011
My Device: Storm
My Carrier: Mobile Vikings

Re: Color Wheel – code offering

This looks great Smiley Happy

As soon as I am back home I'll try it and give feedback, I have project where it would fit well.

Trusted Contributor
Posts: 108
Registered: ‎12-28-2010
My Device: Free PlayBook
My Carrier: Verizon

Re: Color Wheel – code offering

Thanks TheDarkin1978.

Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Color Wheel – code offering

thats some pretty sweet stuff Darkin Smiley Happy thanks for the contribution!!

J. Rab (Blog) (Twitter)
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Developer
Posts: 38
Registered: ‎01-07-2011
My Device: Not Specified

Re: Color Wheel – code offering

Thank you.  I just put it in my app: www.reelportal.com.

Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Color Wheel – code offering

Very nice example code, thank you!

BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!