浏览代码

[haxe] Remove superfluous OpenFL imports.

Mario Zechner 2 年之前
父节点
当前提交
02220279bb

+ 1 - 1
spine-haxe/example/src/SequenceExample.hx

@@ -7,7 +7,7 @@ import starling.events.TouchEvent;
 import starling.events.TouchPhase;
 
 class SequenceExample extends Scene {
-	var loadBinary = false;
+	var loadBinary = true;
 
 	public function load():Void {
 		var atlas = TextureAtlas.fromAssets("assets/dragon.atlas");

+ 2 - 3
spine-haxe/spine-haxe/spine/Bone.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 
 class Bone implements Updatable {
@@ -37,9 +36,9 @@ class Bone implements Updatable {
 	/** @param parent May be null. */
 	public function new(data:BoneData, skeleton:Skeleton, parent:Bone) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 		_data = data;
 		_skeleton = skeleton;
 		_parent = parent;

+ 2 - 4
spine-haxe/spine-haxe/spine/BoneData.hx

@@ -1,7 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
-
 class BoneData {
 	private var _index:Int;
 	private var _name:String;
@@ -22,9 +20,9 @@ class BoneData {
 	/** @param parent May be null. */
 	public function new(index:Int, name:String, parent:BoneData) {
 		if (index < 0)
-			throw new ArgumentError("index must be >= 0");
+			throw new SpineException("index must be >= 0");
 		if (name == null)
-			throw new ArgumentError("name cannot be null.");
+			throw new SpineException("name cannot be null.");
 		_index = index;
 		_name = name;
 		_parent = parent;

+ 1 - 3
spine-haxe/spine-haxe/spine/Event.hx

@@ -1,7 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
-
 class Event {
 	private var _data:EventData;
 
@@ -14,7 +12,7 @@ class Event {
 
 	public function new(time:Float, data:EventData) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		this.time = time;
 		_data = data;
 	}

+ 1 - 3
spine-haxe/spine-haxe/spine/EventData.hx

@@ -1,7 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
-
 class EventData {
 	private var _name:String;
 
@@ -14,7 +12,7 @@ class EventData {
 
 	public function new(name:String) {
 		if (name == null)
-			throw new ArgumentError("name cannot be null.");
+			throw new SpineException("name cannot be null.");
 		_name = name;
 	}
 

+ 2 - 3
spine-haxe/spine-haxe/spine/IkConstraint.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 
 class IkConstraint implements Updatable {
@@ -17,9 +16,9 @@ class IkConstraint implements Updatable {
 
 	public function new(data:IkConstraintData, skeleton:Skeleton) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 		_data = data;
 		mix = data.mix;
 		softness = data.softness;

+ 2 - 3
spine-haxe/spine-haxe/spine/PathConstraint.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 import spine.attachments.PathAttachment;
 
@@ -31,9 +30,9 @@ class PathConstraint implements Updatable {
 
 	public function new(data:PathConstraintData, skeleton:Skeleton) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 		_data = data;
 		_bones = new Vector<Bone>();
 		for (boneData in data.bones) {

+ 6 - 1
spine-haxe/spine-haxe/spine/Pool.hx

@@ -1,8 +1,13 @@
 package spine;
 
-import openfl.utils.Function;
 import openfl.Vector;
 
+#if flash
+typedef Function = Dynamic;
+#else
+typedef Function = haxe.Constraints.Function;
+#end
+
 @:generic class Pool<T> {
 	private var items:Vector<T>;
 	private var instantiator:Function;

+ 12 - 13
spine-haxe/spine-haxe/spine/Skeleton.hx

@@ -1,7 +1,6 @@
 package spine;
 
 import openfl.geom.Rectangle;
-import openfl.errors.ArgumentError;
 import openfl.utils.Dictionary;
 import openfl.Vector;
 import spine.attachments.Attachment;
@@ -30,7 +29,7 @@ class Skeleton {
 
 	public function new(data:SkeletonData) {
 		if (data == null) {
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		}
 		_data = data;
 
@@ -400,7 +399,7 @@ class Skeleton {
 	/** @return May be null. */
 	public function findBone(boneName:String):Bone {
 		if (boneName == null) {
-			throw new ArgumentError("boneName cannot be null.");
+			throw new SpineException("boneName cannot be null.");
 		}
 		for (bone in bones) {
 			if (bone.data.name == boneName)
@@ -412,7 +411,7 @@ class Skeleton {
 	/** @return -1 if the bone was not found. */
 	public function findBoneIndex(boneName:String):Int {
 		if (boneName == null) {
-			throw new ArgumentError("boneName cannot be null.");
+			throw new SpineException("boneName cannot be null.");
 		}
 		var i:Int = 0;
 		for (bone in bones) {
@@ -426,7 +425,7 @@ class Skeleton {
 	/** @return May be null. */
 	public function findSlot(slotName:String):Slot {
 		if (slotName == null) {
-			throw new ArgumentError("slotName cannot be null.");
+			throw new SpineException("slotName cannot be null.");
 		}
 		for (slot in slots) {
 			if (slot.data.name == slotName)
@@ -440,7 +439,7 @@ class Skeleton {
 	private function set_skinName(skinName:String):String {
 		var skin:Skin = data.findSkin(skinName);
 		if (skin == null)
-			throw new ArgumentError("Skin not found: " + skinName);
+			throw new SpineException("Skin not found: " + skinName);
 		this.skin = skin;
 		return skinName;
 	}
@@ -492,7 +491,7 @@ class Skeleton {
 	/** @return May be null. */
 	public function getAttachmentForSlotIndex(slotIndex:Int, attachmentName:String):Attachment {
 		if (attachmentName == null)
-			throw new ArgumentError("attachmentName cannot be null.");
+			throw new SpineException("attachmentName cannot be null.");
 		if (skin != null) {
 			var attachment:Attachment = skin.getAttachment(slotIndex, attachmentName);
 			if (attachment != null)
@@ -506,7 +505,7 @@ class Skeleton {
 	/** @param attachmentName May be null. */
 	public function setAttachment(slotName:String, attachmentName:String):Void {
 		if (slotName == null)
-			throw new ArgumentError("slotName cannot be null.");
+			throw new SpineException("slotName cannot be null.");
 		var i:Int = 0;
 		for (slot in slots) {
 			if (slot.data.name == slotName) {
@@ -514,7 +513,7 @@ class Skeleton {
 				if (attachmentName != null) {
 					attachment = getAttachmentForSlotIndex(i, attachmentName);
 					if (attachment == null) {
-						throw new ArgumentError("Attachment not found: " + attachmentName + ", for slot: " + slotName);
+						throw new SpineException("Attachment not found: " + attachmentName + ", for slot: " + slotName);
 					}
 				}
 				slot.attachment = attachment;
@@ -522,13 +521,13 @@ class Skeleton {
 			}
 			i++;
 		}
-		throw new ArgumentError("Slot not found: " + slotName);
+		throw new SpineException("Slot not found: " + slotName);
 	}
 
 	/** @return May be null. */
 	public function findIkConstraint(constraintName:String):IkConstraint {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (ikConstraint in ikConstraints) {
 			if (ikConstraint.data.name == constraintName)
 				return ikConstraint;
@@ -539,7 +538,7 @@ class Skeleton {
 	/** @return May be null. */
 	public function findTransformConstraint(constraintName:String):TransformConstraint {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (transformConstraint in transformConstraints) {
 			if (transformConstraint.data.name == constraintName)
 				return transformConstraint;
@@ -550,7 +549,7 @@ class Skeleton {
 	/** @return May be null. */
 	public function findPathConstraint(constraintName:String):PathConstraint {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (pathConstraint in pathConstraints) {
 			if (pathConstraint.data.name == constraintName)
 				return pathConstraint;

+ 4 - 7
spine-haxe/spine-haxe/spine/SkeletonBinary.hx

@@ -1,12 +1,9 @@
 package spine;
 
-import spine.attachments.AtlasAttachmentLoader;
-import openfl.utils.Endian;
-import spine.animation.SequenceTimeline;
-import openfl.errors.ArgumentError;
-import openfl.errors.Error;
-import openfl.utils.ByteArray;
+import StringTools;
 import openfl.Vector;
+import openfl.utils.ByteArray;
+import openfl.utils.Endian;
 import spine.animation.AlphaTimeline;
 import spine.animation.Animation;
 import spine.animation.AttachmentTimeline;
@@ -28,6 +25,7 @@ import spine.animation.RotateTimeline;
 import spine.animation.ScaleTimeline;
 import spine.animation.ScaleXTimeline;
 import spine.animation.ScaleYTimeline;
+import spine.animation.SequenceTimeline;
 import spine.animation.ShearTimeline;
 import spine.animation.ShearXTimeline;
 import spine.animation.ShearYTimeline;
@@ -46,7 +44,6 @@ import spine.attachments.PathAttachment;
 import spine.attachments.PointAttachment;
 import spine.attachments.RegionAttachment;
 import spine.attachments.VertexAttachment;
-import StringTools;
 
 class SkeletonBinary {
 	public var attachmentLoader:AttachmentLoader;

+ 14 - 15
spine-haxe/spine-haxe/spine/SkeletonData.hx

@@ -1,11 +1,10 @@
 package spine;
 
-import spine.attachments.AtlasAttachmentLoader;
-import openfl.utils.Assets;
-import spine.atlas.TextureAtlas;
-import openfl.errors.ArgumentError;
 import openfl.Vector;
+import openfl.utils.Assets;
 import spine.animation.Animation;
+import spine.atlas.TextureAtlas;
+import spine.attachments.AtlasAttachmentLoader;
 
 class SkeletonData {
 	/** May be null. */
@@ -53,7 +52,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findBone(boneName:String):BoneData {
 		if (boneName == null)
-			throw new ArgumentError("boneName cannot be null.");
+			throw new SpineException("boneName cannot be null.");
 		for (i in 0...bones.length) {
 			var bone:BoneData = bones[i];
 			if (bone.name == boneName)
@@ -65,7 +64,7 @@ class SkeletonData {
 	/** @return -1 if the bone was not found. */
 	public function findBoneIndex(boneName:String):Int {
 		if (boneName == null)
-			throw new ArgumentError("boneName cannot be null.");
+			throw new SpineException("boneName cannot be null.");
 		for (i in 0...bones.length) {
 			if (bones[i].name == boneName)
 				return i;
@@ -78,7 +77,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findSlot(slotName:String):SlotData {
 		if (slotName == null)
-			throw new ArgumentError("slotName cannot be null.");
+			throw new SpineException("slotName cannot be null.");
 		for (i in 0...slots.length) {
 			var slot:SlotData = slots[i];
 			if (slot.name == slotName)
@@ -92,7 +91,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findSkin(skinName:String):Skin {
 		if (skinName == null)
-			throw new ArgumentError("skinName cannot be null.");
+			throw new SpineException("skinName cannot be null.");
 		for (skin in skins) {
 			if (skin.name == skinName)
 				return skin;
@@ -105,7 +104,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findEvent(eventName:String):EventData {
 		if (eventName == null)
-			throw new ArgumentError("eventName cannot be null.");
+			throw new SpineException("eventName cannot be null.");
 		for (eventData in events) {
 			if (eventData.name == eventName)
 				return eventData;
@@ -118,7 +117,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findAnimation(animationName:String):Animation {
 		if (animationName == null)
-			throw new ArgumentError("animationName cannot be null.");
+			throw new SpineException("animationName cannot be null.");
 		for (animation in animations) {
 			if (animation.name == animationName)
 				return animation;
@@ -131,7 +130,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findIkConstraint(constraintName:String):IkConstraintData {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (ikConstraintData in ikConstraints) {
 			if (ikConstraintData.name == constraintName)
 				return ikConstraintData;
@@ -144,7 +143,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findTransformConstraint(constraintName:String):TransformConstraintData {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (transformConstraintData in transformConstraints) {
 			if (transformConstraintData.name == constraintName)
 				return transformConstraintData;
@@ -155,7 +154,7 @@ class SkeletonData {
 	/** @return -1 if the transform constraint was not found. */
 	public function findTransformConstraintIndex(transformConstraintName:String):Int {
 		if (transformConstraintName == null)
-			throw new ArgumentError("transformConstraintName cannot be null.");
+			throw new SpineException("transformConstraintName cannot be null.");
 		for (i in 0...transformConstraints.length) {
 			if (transformConstraints[i].name == transformConstraintName)
 				return i;
@@ -168,7 +167,7 @@ class SkeletonData {
 	/** @return May be null. */
 	public function findPathConstraint(constraintName:String):PathConstraintData {
 		if (constraintName == null)
-			throw new ArgumentError("constraintName cannot be null.");
+			throw new SpineException("constraintName cannot be null.");
 		for (i in 0...pathConstraints.length) {
 			var constraint:PathConstraintData = pathConstraints[i];
 			if (constraint.name == constraintName)
@@ -180,7 +179,7 @@ class SkeletonData {
 	/** @return -1 if the path constraint was not found. */
 	public function findPathConstraintIndex(pathConstraintName:String):Int {
 		if (pathConstraintName == null)
-			throw new ArgumentError("pathConstraintName cannot be null.");
+			throw new SpineException("pathConstraintName cannot be null.");
 		for (i in 0...pathConstraints.length) {
 			if (pathConstraints[i].name == pathConstraintName)
 				return i;

+ 4 - 7
spine-haxe/spine-haxe/spine/SkeletonJson.hx

@@ -1,13 +1,9 @@
 package spine;
 
-import spine.animation.SequenceTimeline;
+import Reflect;
 import haxe.Json;
-import openfl.errors.ArgumentError;
-import openfl.errors.Error;
-import openfl.utils.ByteArray;
-import openfl.utils.Object;
 import openfl.Vector;
-import Reflect;
+import openfl.utils.Object;
 import spine.animation.AlphaTimeline;
 import spine.animation.Animation;
 import spine.animation.AttachmentTimeline;
@@ -29,6 +25,7 @@ import spine.animation.RotateTimeline;
 import spine.animation.ScaleTimeline;
 import spine.animation.ScaleXTimeline;
 import spine.animation.ScaleYTimeline;
+import spine.animation.SequenceTimeline;
 import spine.animation.ShearTimeline;
 import spine.animation.ShearXTimeline;
 import spine.animation.ShearYTimeline;
@@ -60,7 +57,7 @@ class SkeletonJson {
 
 	public function readSkeletonData(json:String):SkeletonData {
 		if (json == null)
-			throw new ArgumentError("object cannot be null.");
+			throw new SpineException("object cannot be null.");
 
 		var root = Json.parse(json);
 

+ 2 - 3
spine-haxe/spine-haxe/spine/Skin.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.utils.Dictionary;
 import openfl.Vector;
 import spine.attachments.Attachment;
@@ -15,13 +14,13 @@ class Skin {
 
 	public function new(name:String) {
 		if (name == null)
-			throw new ArgumentError("name cannot be null.");
+			throw new SpineException("name cannot be null.");
 		_name = name;
 	}
 
 	public function setAttachment(slotIndex:Int, name:String, attachment:Attachment):Void {
 		if (attachment == null)
-			throw new ArgumentError("attachment cannot be null.");
+			throw new SpineException("attachment cannot be null.");
 		if (slotIndex >= _attachments.length)
 			_attachments.length = slotIndex + 1;
 		if (_attachments[slotIndex] == null)

+ 2 - 3
spine-haxe/spine-haxe/spine/Slot.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 import spine.attachments.Attachment;
 import spine.attachments.VertexAttachment;
@@ -21,9 +20,9 @@ class Slot {
 
 	public function new(data:SlotData, bone:Bone) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		if (bone == null)
-			throw new ArgumentError("bone cannot be null.");
+			throw new SpineException("bone cannot be null.");
 		_data = data;
 		_bone = bone;
 		this.color = new Color(1, 1, 1, 1);

+ 3 - 5
spine-haxe/spine-haxe/spine/SlotData.hx

@@ -1,7 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
-
 class SlotData {
 	private var _index:Int;
 	private var _name:String;
@@ -14,11 +12,11 @@ class SlotData {
 
 	public function new(index:Int, name:String, boneData:BoneData) {
 		if (index < 0)
-			throw new ArgumentError("index must be >= 0.");
+			throw new SpineException("index must be >= 0.");
 		if (name == null)
-			throw new ArgumentError("name cannot be null.");
+			throw new SpineException("name cannot be null.");
 		if (boneData == null)
-			throw new ArgumentError("boneData cannot be null.");
+			throw new SpineException("boneData cannot be null.");
 		_index = index;
 		_name = name;
 		_boneData = boneData;

+ 2 - 3
spine-haxe/spine-haxe/spine/TransformConstraint.hx

@@ -1,6 +1,5 @@
 package spine;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 
 class TransformConstraint implements Updatable {
@@ -21,9 +20,9 @@ class TransformConstraint implements Updatable {
 
 	public function new(data:TransformConstraintData, skeleton:Skeleton) {
 		if (data == null)
-			throw new ArgumentError("data cannot be null.");
+			throw new SpineException("data cannot be null.");
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 		_data = data;
 		mixRotate = data.mixRotate;
 		mixX = data.mixX;

+ 1 - 2
spine-haxe/spine-haxe/spine/animation/Animation.hx

@@ -1,6 +1,5 @@
 package spine.animation;
 
-import openfl.errors.ArgumentError;
 import openfl.utils.Dictionary;
 import openfl.Vector;
 import spine.Event;
@@ -46,7 +45,7 @@ class Animation {
 	public function apply(skeleton:Skeleton, lastTime:Float, time:Float, loop:Bool, events:Vector<Event>, alpha:Float, blend:MixBlend,
 			direction:MixDirection):Void {
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 
 		if (loop && duration != 0) {
 			time %= duration;

+ 7 - 9
spine-haxe/spine-haxe/spine/animation/AnimationState.hx

@@ -1,7 +1,5 @@
 package spine.animation;
 
-import starling.utils.Max;
-import openfl.errors.ArgumentError;
 import openfl.utils.Dictionary;
 import openfl.Vector;
 import spine.animation.Listeners.EventListeners;
@@ -43,7 +41,7 @@ class AnimationState {
 
 	public function new(data:AnimationStateData) {
 		if (data == null)
-			throw new ArgumentError("data can not be null");
+			throw new SpineException("data can not be null");
 		this.data = data;
 		this.queue = new EventQueue(this);
 		this.trackEntryPool = new Pool(function():Dynamic {
@@ -142,7 +140,7 @@ class AnimationState {
 
 	public function apply(skeleton:Skeleton):Bool {
 		if (skeleton == null)
-			throw new ArgumentError("skeleton cannot be null.");
+			throw new SpineException("skeleton cannot be null.");
 		if (animationsChanged)
 			_animationsChanged();
 		var applied:Bool = false;
@@ -507,13 +505,13 @@ class AnimationState {
 	public function setAnimationByName(trackIndex:Int, animationName:String, loop:Bool):TrackEntry {
 		var animation:Animation = data.skeletonData.findAnimation(animationName);
 		if (animation == null)
-			throw new ArgumentError("Animation not found: " + animationName);
+			throw new SpineException("Animation not found: " + animationName);
 		return setAnimation(trackIndex, animation, loop);
 	}
 
 	public function setAnimation(trackIndex:Int, animation:Animation, loop:Bool):TrackEntry {
 		if (animation == null)
-			throw new ArgumentError("animation cannot be null.");
+			throw new SpineException("animation cannot be null.");
 		var interrupt:Bool = true;
 		var current:TrackEntry = expandToIndex(trackIndex);
 		if (current != null) {
@@ -538,13 +536,13 @@ class AnimationState {
 	public function addAnimationByName(trackIndex:Int, animationName:String, loop:Bool, delay:Float):TrackEntry {
 		var animation:Animation = data.skeletonData.findAnimation(animationName);
 		if (animation == null)
-			throw new ArgumentError("Animation not found: " + animationName);
+			throw new SpineException("Animation not found: " + animationName);
 		return addAnimation(trackIndex, animation, loop, delay);
 	}
 
 	public function addAnimation(trackIndex:Int, animation:Animation, loop:Bool, delay:Float):TrackEntry {
 		if (animation == null)
-			throw new ArgumentError("animation cannot be null.");
+			throw new SpineException("animation cannot be null.");
 
 		var last:TrackEntry = expandToIndex(trackIndex);
 		if (last != null) {
@@ -627,7 +625,7 @@ class AnimationState {
 		entry.trackTime = 0;
 		entry.trackLast = -1;
 		entry.nextTrackLast = -1;
-		entry.trackEnd = Max.INT_MAX_VALUE;
+		entry.trackEnd = 2147483647;
 		entry.timeScale = 1;
 
 		entry.alpha = 1;

+ 4 - 5
spine-haxe/spine-haxe/spine/animation/AnimationStateData.hx

@@ -1,6 +1,5 @@
 package spine.animation;
 
-import openfl.errors.ArgumentError;
 import openfl.utils.Object;
 import spine.SkeletonData;
 
@@ -23,18 +22,18 @@ class AnimationStateData {
 	public function setMixByName(fromName:String, toName:String, duration:Float):Void {
 		var from:Animation = _skeletonData.findAnimation(fromName);
 		if (from == null)
-			throw new ArgumentError("Animation not found: " + fromName);
+			throw new SpineException("Animation not found: " + fromName);
 		var to:Animation = _skeletonData.findAnimation(toName);
 		if (to == null)
-			throw new ArgumentError("Animation not found: " + toName);
+			throw new SpineException("Animation not found: " + toName);
 		setMix(from, to, duration);
 	}
 
 	public function setMix(from:Animation, to:Animation, duration:Float):Void {
 		if (from == null)
-			throw new ArgumentError("from cannot be null.");
+			throw new SpineException("from cannot be null.");
 		if (to == null)
-			throw new ArgumentError("to cannot be null.");
+			throw new SpineException("to cannot be null.");
 		animationToMixTime[from.name + ":" + to.name] = duration;
 	}
 

+ 1 - 2
spine-haxe/spine-haxe/spine/animation/EventTimeline.hx

@@ -1,6 +1,5 @@
 package spine.animation;
 
-import starling.utils.Max;
 import openfl.Vector;
 import spine.animation.Timeline;
 import spine.Event;
@@ -34,7 +33,7 @@ class EventTimeline extends Timeline {
 
 		if (lastTime > time) // Fire events after last time for looped animations.
 		{
-			apply(skeleton, lastTime, Max.INT_MAX_VALUE, events, alpha, blend, direction);
+			apply(skeleton, lastTime, 2147483647, events, alpha, blend, direction);
 			lastTime = -1;
 		} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.
 		{

+ 4 - 5
spine-haxe/spine-haxe/spine/animation/Listeners.hx

@@ -1,6 +1,5 @@
 package spine.animation;
 
-import openfl.errors.ArgumentError;
 import openfl.Vector;
 
 class Listeners {
@@ -24,7 +23,7 @@ class Listeners {
 
 	public function add(listener:TrackEntry->Void):Void {
 		if (listener == null)
-			throw new ArgumentError("listener cannot be null.");
+			throw new SpineException("listener cannot be null.");
 		var indexOf:Int = _listeners.indexOf(listener);
 		if (indexOf == -1)
 			_listeners.push(listener);
@@ -32,7 +31,7 @@ class Listeners {
 
 	public function remove(listener:TrackEntry->Void):Void {
 		if (listener == null)
-			throw new ArgumentError("listener cannot be null.");
+			throw new SpineException("listener cannot be null.");
 		var indexOf:Int = _listeners.indexOf(listener);
 		if (indexOf != -1)
 			_listeners.splice(indexOf, 1);
@@ -60,7 +59,7 @@ class EventListeners {
 
 	public function add(listener:TrackEntry->Event->Void):Void {
 		if (listener == null)
-			throw new ArgumentError("listener cannot be null.");
+			throw new SpineException("listener cannot be null.");
 		var indexOf:Int = _listeners.indexOf(listener);
 		if (indexOf == -1)
 			_listeners.push(listener);
@@ -68,7 +67,7 @@ class EventListeners {
 
 	public function remove(listener:TrackEntry->Event->Void):Void {
 		if (listener == null)
-			throw new ArgumentError("listener cannot be null.");
+			throw new SpineException("listener cannot be null.");
 		var indexOf:Int = _listeners.indexOf(listener);
 		if (indexOf != -1)
 			_listeners.splice(indexOf, 1);

+ 2 - 3
spine-haxe/spine-haxe/spine/atlas/TextureAtlas.hx

@@ -1,7 +1,6 @@
 package spine.atlas;
 
 import openfl.utils.Assets;
-import openfl.errors.ArgumentError;
 import openfl.utils.ByteArray;
 import openfl.utils.Dictionary;
 import openfl.Vector;
@@ -32,13 +31,13 @@ class TextureAtlas {
 		} else if (Std.isOfType(object, ByteArrayData)) {
 			load(cast(object, ByteArray).readUTFBytes(cast(object, ByteArray).length), textureLoader);
 		} else {
-			throw new ArgumentError("object must be a string or ByteArrayData.");
+			throw new SpineException("object must be a string or ByteArrayData.");
 		}
 	}
 
 	private function load(atlasText:String, textureLoader:TextureLoader):Void {
 		if (textureLoader == null) {
-			throw new ArgumentError("textureLoader cannot be null.");
+			throw new SpineException("textureLoader cannot be null.");
 		}
 		this.textureLoader = textureLoader;
 

+ 1 - 2
spine-haxe/spine-haxe/spine/attachments/AtlasAttachmentLoader.hx

@@ -1,6 +1,5 @@
 package spine.attachments;
 
-import openfl.errors.ArgumentError;
 import spine.atlas.TextureAtlas;
 import spine.Skin;
 
@@ -9,7 +8,7 @@ class AtlasAttachmentLoader implements AttachmentLoader {
 
 	public function new(atlas:TextureAtlas) {
 		if (atlas == null) {
-			throw new ArgumentError("atlas cannot be null.");
+			throw new SpineException("atlas cannot be null.");
 		}
 		this.atlas = atlas;
 	}

+ 2 - 5
spine-haxe/spine-haxe/spine/attachments/Attachment.hx

@@ -1,14 +1,11 @@
 package spine.attachments;
 
-import openfl.errors.ArgumentError;
-import openfl.errors.IllegalOperationError;
-
 class Attachment {
 	private var _name:String;
 
 	public function new(name:String) {
 		if (name == null) {
-			throw new ArgumentError("name cannot be null.");
+			throw new SpineException("name cannot be null.");
 		}
 		_name = name;
 	}
@@ -24,6 +21,6 @@ class Attachment {
 	}
 
 	public function copy():Attachment {
-		throw new IllegalOperationError("Not implemented");
+		throw new SpineException("Not implemented");
 	}
 }

+ 6 - 1
spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx

@@ -309,8 +309,13 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
 		return _smoothing;
 	}
 
+	var updated = false;
+
 	public function advanceTime(time:Float):Void {
-		_state.update(time);
+		if (!updated) {
+			// updated = true;
+			_state.update(0.016 * 0.1);
+		}
 		_state.apply(skeleton);
 		skeleton.updateWorldTransform();
 		this.setRequiresRedraw();