I usually don't use parseInt for this purpose I usually just cast it as a uint.
i.e.
uint(c);
would work as well.
glad you figured it out.
- Taka
On Tue, Feb 10, 2009 at 5:54 AM, ali drongo wrote:
> Thanks everyone, Juan, you solved the final part of the puzzle and Muzak
> thanks for your ut
Thanks everyone, Juan, you solved the final part of the puzzle and Muzak
thanks for your utility class it's very useful.
Cheers again!
Ali
On Tue, Feb 10, 2009 at 1:13 PM, Muzak wrote:
> Maybe this will help?
> http://muzakdeezign.com/flex3/flex3lib/ColorUtil.zip
>
> //docs
>
> http://muzakdeezi
Hi Ali,
If you need to switch between different number systems, you can also
try this:
var myUint:uint = 0xff; // this is the colour red
trace (myUint.toString(16)); //will trace ff -- in hexadecimal
system;
trace (myUint.toString(2)); //will trace --
in
Maybe this will help?
http://muzakdeezign.com/flex3/flex3lib/ColorUtil.zip
//docs
http://muzakdeezign.com/flex3/flex3lib/docs/com/muzakdeezign/flex/utils/ColorUtil.html
regards,
Muzak
- Original Message -
From: "ali drongo"
To: "Flash Coders List"
Sent: Monday, February 09, 2009 6:2
The problem seems to be here:
var hexNum:Number = parseInt(c, 16);
You're asking parseInt to convert a string to an integer and telling it the
string is an hexadecimal representation, when it's decimal, according to
this line:
trace("string colour:"+c); // e.g. for red: 16711680
So try,
hexNu
Thanks for your responses guys. I'm still stuck on this and I have been
playing around a lot. I can get the number from the decimal format to the
hex string but when I try to convert it to a hex number the colour is
incorrect.
Any advice much much appreciated, this is taking up lots of time.
Thank
Courtesy Evan Mullins of Circlecube Studio:
//bitwise conversion of rgb color to a hex value
function rgb2hex(r, g, b):Number
{
return(r<<16 | g<<8 | b);
}
//bitwise conversion of a hex color into rgb values
function hex2rgb (hex):Object
{
var red = hex>>16;
var greenBlue = hex-(red<
On Mon, Feb 9, 2009 at 6:26 PM, ali drongo wrote:
> currColor = Number("0x"+c);
I haven't looked into it in detail, but I think you would want to use
parseInt( "0x" + c, 16 ) here.
If that doesn't fix it, try tracing the values throughout your
conversion and see where it breaks.
Mark
___
8 matches
Mail list logo