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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
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

 

 

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);
		}
	}
}

 

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
Please use plain text.
Developer
LoganSix
Posts: 164
Registered: ‎01-02-2011
My Carrier: Sprint

Re: Color Wheel – code offering

Cool.

 

_________________
Meetup Search Tool - not available at the moment
Please use plain text.
Developer
Aenimea
Posts: 96
Registered: ‎01-20-2011
My Carrier: Mobile Vikings

Re: Color Wheel – code offering

This looks great :smileyhappy:

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

Aenimea
Please use plain text.
Trusted Contributor
PBDev
Posts: 108
Registered: ‎12-28-2010
My Carrier: Verizon

Re: Color Wheel – code offering

Thanks TheDarkin1978.

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010

Re: Color Wheel – code offering

thats some pretty sweet stuff Darkin :smileyhappy: 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
Please use plain text.
New Developer
reelportal
Posts: 35
Registered: ‎01-07-2011

Re: Color Wheel – code offering

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

Please use plain text.
Developer
zezke
Posts: 831
Registered: ‎12-12-2010
My Carrier: Mobile Vikings

Re: Color Wheel – code offering

Very nice example code, thank you!

-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.