From c4e1b118455f13878396942d7d454543f8e08b43 Mon Sep 17 00:00:00 2001 From: Ryan McKay Date: Thu, 25 Jul 2013 20:32:37 +1200 Subject: [PATCH] Fixed toColor function returning NaN Tested the 'toColor' function with 'ffffff00'. The returned result (in r,g,b,a) was 1,NaN,1,257. The correct result should obviously be 1,1,1,0. The hex substring was being done incorrectly. --- spine-js/spine.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spine-js/spine.js b/spine-js/spine.js index 388836a30..45da47f30 100644 --- a/spine-js/spine.js +++ b/spine-js/spine.js @@ -1,4 +1,3 @@ - var spine = {}; spine.BoneData = function (name, parent) { @@ -1078,7 +1077,7 @@ spine.SkeletonJson.readCurve = function (timeline, frameIndex, valueMap) { }; spine.SkeletonJson.toColor = function (hexString, colorIndex) { if (hexString.length != 8) throw "Color hexidecimal length must be 8, recieved: " + hexString; - return parseInt(hexString.substring(colorIndex * 2, 2), 16) / 255; + return parseInt(hexString.substring(colorIndex * 2, (colorIndex * 2)+2), 16) / 255; }; spine.Atlas = function (atlasText, textureLoader) {