shawn, you changed the rules.
first you gave input of string and now you give hex.
try to make up your mind!

doing simple test run:

code:
$in= "&00FFFF"
val($in) ?
$level
function fadetoblack($i,$l)
Dim $, $c, $x
$l=right($l,2)
for $x=1 to 3
$c=substr($i,$x*2,2)
$=$+iif($l>$c,$c,$l)
next
$fadetoblack=val("&"+$)
endfunction
fadetoblack( "&00FFFF","&DD")

get $

gives correct results.
_________________________
!

download KiXnet