diff --git a/spine-as3/spine-as3/src/spine/SkeletonJson.as b/spine-as3/spine-as3/src/spine/SkeletonJson.as index 615fa54fc..a3e8c04c3 100644 --- a/spine-as3/spine-as3/src/spine/SkeletonJson.as +++ b/spine-as3/spine-as3/src/spine/SkeletonJson.as @@ -176,27 +176,27 @@ public class SkeletonJson { var color:String, vertices:Vector.; switch (type) { case AttachmentType.region: - var regionAttachment:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, path); - if (!regionAttachment) return null; - regionAttachment.path = path; - regionAttachment.x = (map["x"] || 0) * scale; - regionAttachment.y = (map["y"] || 0) * scale; - regionAttachment.scaleX = map.hasOwnProperty("scaleX") ? map["scaleX"] : 1; - regionAttachment.scaleY = map.hasOwnProperty("scaleY") ? map["scaleY"] : 1; - regionAttachment.rotation = map["rotation"] || 0; - regionAttachment.width = (map["width"] || 0) * scale; - regionAttachment.height = (map["height"] || 0) * scale; + var region:RegionAttachment = attachmentLoader.newRegionAttachment(skin, name, path); + if (!region) return null; + region.path = path; + region.x = (map["x"] || 0) * scale; + region.y = (map["y"] || 0) * scale; + region.scaleX = map.hasOwnProperty("scaleX") ? map["scaleX"] : 1; + region.scaleY = map.hasOwnProperty("scaleY") ? map["scaleY"] : 1; + region.rotation = map["rotation"] || 0; + region.width = (map["width"] || 0) * scale; + region.height = (map["height"] || 0) * scale; color = map["color"]; if (color) { - regionAttachment.r = toColor(color, 0); - regionAttachment.g = toColor(color, 1); - regionAttachment.b = toColor(color, 2); - regionAttachment.a = toColor(color, 3); + region.r = toColor(color, 0); + region.g = toColor(color, 1); + region.b = toColor(color, 2); + region.a = toColor(color, 3); } - regionAttachment.updateOffset(); - return regionAttachment; + region.updateOffset(); + return region; case AttachmentType.mesh: var mesh:MeshAttachment = attachmentLoader.newMeshAttachment(skin, name, path); @@ -205,7 +205,7 @@ public class SkeletonJson { mesh.vertices = getFloatArray(map, "vertices", scale); mesh.triangles = getIntArray(map, "triangles"); mesh.regionUVs = getFloatArray(map, "uvs", 1); - mesh.UpdateUVs(); + mesh.updateUVs(); color = map["color"]; if (color) { @@ -216,15 +216,15 @@ public class SkeletonJson { } mesh.hullLength = (map["hull"] || 0) * 2; - if (map["edges"]) mesh.Edges = getIntArray(map, "edges"); + if (map["edges"]) mesh.edges = getIntArray(map, "edges"); mesh.width = (map["width"] || 0) * scale; mesh.height = (map["height"] || 0) * scale; return mesh; case AttachmentType.skinnedmesh: var skinnedMesh:SkinnedMeshAttachment = attachmentLoader.newSkinnedMeshAttachment(skin, name, path); if (!skinnedMesh) return null; - - skinnedMesh.Path = path; + skinnedMesh.path = path; + var uvs:Vector. = getFloatArray(map, "uvs", 1); vertices = getFloatArray(map, "vertices", 1); var weights:Vector. = new Vector.(); @@ -255,7 +255,7 @@ public class SkeletonJson { } skinnedMesh.hullLength = (map["hull"] || 0) * 2; - if (map["edges"]) skinnedMesh.Edges = getIntArray(map, "edges"); + if (map["edges"]) skinnedMesh.edges = getIntArray(map, "edges"); skinnedMesh.width = (map["width"] || 0) * scale; skinnedMesh.height = (map["height"] || 0) * scale; return skinnedMesh; @@ -382,8 +382,8 @@ public class SkeletonJson { if (!attachment) throw new Error("FFD attachment not found: " + meshName); ffdTimeline.slotIndex = slotIndex; ffdTimeline.attachment = attachment; - - var vertexCount:int ; + + var vertexCount:int; if (attachment is MeshAttachment) vertexCount = (attachment as MeshAttachment).vertices.length; else @@ -501,7 +501,7 @@ public class SkeletonJson { static private function getFloatArray (map:Object, name:String, scale:Number) : Vector. { var list:Array = map[name]; - var values:Vector. = new Vector.(list.Count, true); + var values:Vector. = new Vector.(list.length, true); var i:int = 0, n:int = list.length; if (scale == 1) { for (; i < n; i++) @@ -515,7 +515,7 @@ public class SkeletonJson { static private function getIntArray (map:Object, name:String) : Vector. { var list:Array = map[name]; - var values:Vector. = new Vector.(list.Count, true); + var values:Vector. = new Vector.(list.length, true); for (var i:int = 0, n:int = list.length; i < n; i++) values[i] = int(list[i]); return values; diff --git a/spine-as3/spine-as3/src/spine/animation/FfdTimeline.as b/spine-as3/spine-as3/src/spine/animation/FfdTimeline.as index d511de676..fa500c8dd 100644 --- a/spine-as3/spine-as3/src/spine/animation/FfdTimeline.as +++ b/spine-as3/spine-as3/src/spine/animation/FfdTimeline.as @@ -74,7 +74,7 @@ public class FfdTimeline extends CurveTimeline { var i:int; if (time >= frames[frames.length - 1]) { // Time is after last frame. - var lastVertices:Vector. = frameVertices[frames.length - 1]; + var lastVertices:Vector. = frameVertices[int(frames.length - 1)]; if (alpha < 1) { for (i = 0; i < vertexCount; i++) vertices[i] += (lastVertices[i] - vertices[i]) * alpha; @@ -88,10 +88,10 @@ public class FfdTimeline extends CurveTimeline { // Interpolate between the previous frame and the current frame. var frameIndex:int = Animation.binarySearch(frames, time, 1); var frameTime:Number = frames[frameIndex]; - var percent:Number = 1 - (time - frameTime) / (frames[frameIndex - 1] - frameTime); + var percent:Number = 1 - (time - frameTime) / (frames[int(frameIndex - 1)] - frameTime); percent = getCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent)); - var prevVertices:Vector. = frameVertices[frameIndex - 1]; + var prevVertices:Vector. = frameVertices[int(frameIndex - 1)]; var nextVertices:Vector. = frameVertices[frameIndex]; var prev:Number; diff --git a/spine-as3/spine-as3/src/spine/attachments/MeshAttachment.as b/spine-as3/spine-as3/src/spine/attachments/MeshAttachment.as index a79e67396..e3052c0b9 100644 --- a/spine-as3/spine-as3/src/spine/attachments/MeshAttachment.as +++ b/spine-as3/spine-as3/src/spine/attachments/MeshAttachment.as @@ -66,19 +66,19 @@ public dynamic class MeshAttachment extends Attachment { super(name); } - public function UpdateUVs () : void { + public function updateUVs () : void { var width:Number = regionU2 - regionU, height:Number = regionV2 - regionV; - if (!uvs || uvs.length != regionUVs.length) uvs = new Vector.(regionUVs.length, true); var i:int, n:int = uvs.length; + if (!uvs || uvs.length != n) uvs = new Vector.(n, true); if (regionRotate) { for (i = 0; i < n; i += 2) { - uvs[i] = regionU + regionUVs[i + 1] * width; - uvs[i + 1] = regionV + height - regionUVs[i] * height; + uvs[i] = regionU + regionUVs[int(i + 1)] * width; + uvs[int(i + 1)] = regionV + height - regionUVs[i] * height; } } else { for (i = 0; i < n; i += 2) { uvs[i] = regionU + regionUVs[i] * width; - uvs[i + 1] = regionV + regionUVs[i + 1] * height; + uvs[int(i + 1)] = regionV + regionUVs[int(i + 1)] * height; } } } @@ -94,11 +94,11 @@ public dynamic class MeshAttachment extends Attachment { var vertices:Vector. = this.vertices; var verticesCount:int = vertices.length; if (slot.attachmentVertices.length == verticesCount) vertices = slot.attachmentVertices; - for (var i:int = 0; i < verticesCount; i += 2) { + for (var i:int = 0, ii:int = 0; i < verticesCount; i += 2, ii += 2) { var vx:Number = vertices[i]; - var vy:Number = vertices[i + 1]; + var vy:Number = vertices[ii]; worldVertices[i] = vx * m00 + vy * m01 + x; - worldVertices[i + 1] = vx * m10 + vy * m11 + y; + worldVertices[ii] = vx * m10 + vy * m11 + y; } } } diff --git a/spine-as3/spine-as3/src/spine/attachments/SkinnedMeshAttachment.as b/spine-as3/spine-as3/src/spine/attachments/SkinnedMeshAttachment.as index 658ead170..630d203eb 100644 --- a/spine-as3/spine-as3/src/spine/attachments/SkinnedMeshAttachment.as +++ b/spine-as3/spine-as3/src/spine/attachments/SkinnedMeshAttachment.as @@ -67,19 +67,19 @@ public dynamic class SkinnedMeshAttachment extends Attachment { super(name); } - public function UpdateUVs () : void { + public function updateUVs () : void { var width:Number = regionU2 - regionU, height:Number = regionV2 - regionV; - if (!uvs || uvs.length != regionUVs.length) uvs = new Vector.(regionUVs.length, true); var i:int, n:int = uvs.length; + if (!uvs || uvs.length != n) uvs = new Vector.(n, true); if (regionRotate) { for (i = 0; i < n; i += 2) { - uvs[i] = regionU + regionUVs[i + 1] * width; - uvs[i + 1] = regionV + height - regionUVs[i] * height; + uvs[i] = regionU + regionUVs[int(i + 1)] * width; + uvs[int(i + 1)] = regionV + height - regionUVs[i] * height; } } else { for (i = 0; i < n; i += 2) { uvs[i] = regionU + regionUVs[i] * width; - uvs[i + 1] = regionV + regionUVs[i + 1] * height; + uvs[int(i + 1)] = regionV + regionUVs[int(i + 1)] * height; } } } @@ -99,13 +99,13 @@ public dynamic class SkinnedMeshAttachment extends Attachment { for (; v < nn; v++, b += 3) { bone = skeletonBones[bones[v]]; vx = weights[b]; - vy = weights[b + 1]; - weight = weights[b + 2]; + vy = weights[int(b + 1)]; + weight = weights[int(b + 2)]; wx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight; wy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight; } worldVertices[w] = wx + x; - worldVertices[w + 1] = wy + y; + worldVertices[int(w + 1)] = wy + y; } } else { var ffd:Vector. = slot.attachmentVertices; @@ -116,13 +116,13 @@ public dynamic class SkinnedMeshAttachment extends Attachment { for (; v < nn; v++, b += 3, f += 2) { bone = skeletonBones[bones[v]]; vx = weights[b] + ffd[f]; - vy = weights[b + 1] + ffd[f + 1]; - weight = weights[b + 2]; + vy = weights[int(b + 1)] + ffd[int(f + 1)]; + weight = weights[int(b + 2)]; wx += (vx * bone.m00 + vy * bone.m01 + bone.worldX) * weight; wy += (vx * bone.m10 + vy * bone.m11 + bone.worldY) * weight; } worldVertices[w] = wx + x; - worldVertices[w + 1] = wy + y; + worldVertices[int(w + 1)] = wy + y; } } }