Problem in setting RGB

What I’m trying to do right now is to extract a numerical value from an XML file and change the color of an object accordingly. Here’s what I have wrote:

onClipEvent (mouseMove) {
var gdp = 0;
for (var i = 0; i<_root.world.length; i++) {
if (_root.world*.attributes.name == “Asia”) {
var asia = _root.world*.childNodes;
for (var j = 0; j<asia.length; j++) {
if (asia[j].attributes.name == “South Korea”) {
var korea = asia[j].childNodes;
for (var k = 0; k<korea.length; k++) {
if (korea[k].nodeName == “GDP” && korea[k].attributes.year == _root.year) {
gdp = korea[k].firstChild.nodeValue;
}
}
}
}
}
}
colorobj = new Color(this.korea);
trace(colorobj.getRGB());
var colorValue = (gdp/5000)*255;
var R = (255 - colorValue)65536;
var G = colorValue
256;
var B = 0;
colorobj.setRGB(R+G+B);
}

The looping part works fine. I could get the value I wanted. The color change part also worked fine by itself. When I put a certain number in gdp and the color was set successfully.
The problem is when I combine these two together. Not only korea’s color wasn’t changed, but trace(colorobj.getRGB()); showed undefined instead of displaying the original color’s code.
Can anyone tell me what’s wrong? I’m really stuck…