Ok, this looked like a fun project so I wrote code to construct an array of all web-safe colors:

hexColors = new Array("00", "33", "66", "99", "CC", "FF");
webSafePalette = new Array();
// length of webSafePalette will be length of hexColors cubed:
for (i = 0; i < Math.pow(hexColors.length, 3); i++) {
        for (r = 0; r < hexColors.length; r++) {
                for (g = 0; g < hexColors.length; g++) {
                        for (b = 0; b < hexColors.length; b++) {
webSafePalette[webSafePalette.length] = "0x" + hexColors[r] + hexColors[g] + hexColors[b];
                        }
                }
        }
}
// returns 216 values in hexadecimal format:
trace (webSafePalette);

You could modify to produce more colors just by modifying the elements in hexColors to reflect the number of incremental values for red, green, and blue.

Marc


At 10:56 AM 8/22/2006, you wrote:

Errors-To: [EMAIL PROTECTED]
X-UIDL: 4[(!!IlZ"!T">"![52"!

Anyone have a function that returns an array of the hex color values for
a particular range (i.e., say the 144 hex colors you see in the Flash
IDE's color picker)?  Or know how to write one?  I'm not looking for a
complete color picker class or component, I'm creating my own with
specific needs, but to do so, I'm not sure how the hex number math
works.  Don't really want to enter all the values manually.

Thanks.

Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to