diff --git a/src/as/com/threerings/flash/FloatingTextAnimation.as b/src/as/com/threerings/flash/FloatingTextAnimation.as index e15d388d..b7d29396 100644 --- a/src/as/com/threerings/flash/FloatingTextAnimation.as +++ b/src/as/com/threerings/flash/FloatingTextAnimation.as @@ -1,5 +1,7 @@ package com.threerings.flash { +import flash.display.Sprite; + import flash.events.Event; import flash.filters.GlowFilter; @@ -8,9 +10,10 @@ import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; -public class FloatingTextAnimation extends TextField +public class FloatingTextAnimation extends Sprite implements Animation { +/* public static function create ( text :String, duration :Number = 1000, dy :int = -10, size :int = 18, font :String = "Arial", bold :Boolean = true, @@ -35,24 +38,29 @@ public class FloatingTextAnimation extends TextField return fta; } + */ public var duration :Number; public var dy :Number; - public function FloatingTextAnimation () + public function FloatingTextAnimation ( + text :String, textArgs :Object = null, duration :Number = 1000, dy :int = -10) { - AnimationManager.addDisplayAnimation(this); - } + var tf :TextField = TextFieldUtil.createField(text, textArgs); + tf.x = -(tf.width/2) + tf.y = -(tf.height/2); + addChild(tf); - override public function set x (val :Number) :void - { - super.x = (val - width/2); + this.duration = duration; + this.dy = dy; + + AnimationManager.addDisplayAnimation(this); } override public function set y (val :Number) :void { - super.y = _startY = (val - height/2); + super.y = _startY = val; } // from Animation diff --git a/src/as/com/threerings/flash/SiningTextAnimation.as b/src/as/com/threerings/flash/SiningTextAnimation.as index 67c86085..cac436bc 100644 --- a/src/as/com/threerings/flash/SiningTextAnimation.as +++ b/src/as/com/threerings/flash/SiningTextAnimation.as @@ -4,9 +4,9 @@ import flash.text.TextFormat; public class SiningTextAnimation extends TextCharAnimation { - public function SiningTextAnimation (text :String, format :TextFormat) + public function SiningTextAnimation (text :String, textArgs :Object) { - super(text, movementFn, format); + super(text, movementFn, textArgs); } protected function movementFn (elapsed :Number, index :Number) :Number diff --git a/src/as/com/threerings/flash/TextCharAnimation.as b/src/as/com/threerings/flash/TextCharAnimation.as index 5512d7a8..1d7adba0 100644 --- a/src/as/com/threerings/flash/TextCharAnimation.as +++ b/src/as/com/threerings/flash/TextCharAnimation.as @@ -13,7 +13,7 @@ import flash.utils.getTimer; // function import public class TextCharAnimation extends Sprite implements Animation { - public function TextCharAnimation (text :String, fn :Function, format :TextFormat) + public function TextCharAnimation (text :String, fn :Function, textArgs :Object) { _fn = fn; @@ -23,11 +23,7 @@ public class TextCharAnimation extends Sprite var h :Number = 0; var tf :TextField; for (var ii :int = 0; ii < text.length; ii++) { - tf = createTextField(format); - tf.autoSize = TextFieldAutoSize.CENTER; - tf.text = text.charAt(ii); - tf.width = tf.textWidth + 5; - tf.height = tf.textHeight + 5; + tf = TextFieldUtil.createField(text.charAt(ii), textArgs); tf.x = w; w += tf.width; @@ -52,15 +48,6 @@ public class TextCharAnimation extends Sprite } } - protected function createTextField (format :TextFormat) :TextField - { - var tf :TextField = new TextField(); - tf.defaultTextFormat = format; - return tf; - } - - protected var _startStamp :Number; - protected var _texts :Array = []; protected var _fn :Function;