Use & instead of % r = (col >> 16) & 0xFF; g = (col >> 8) & 0xFF; b = col & 0xFF;
Glen :) Alias™ wrote:
Hi guys, This is annoying me - I'm just trying to get the seperate RGB component values out of a hex number, then manipulate and reconstruct them. var col = 0xFFEEEE; r = col >> 16; g = col >> 8 % 255; b = col % 255; trace("r="+r.toString(16)); trace("g="+g.toString(16)); trace("b="+b.toString(16)); col2 = r <<16 + g << 8 + b; trace("col2="+col2.toString(16)); Anyone got any idea why this isn't working right? My blue values are doing all sorts of wierd stuff - getting smaller, flipping out etc - is it a modulo problem maybe? Should be simple but this always gets me... Any help much appreciated, Alias _______________________________________________ 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
_______________________________________________ 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