In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

FlowText v 0.1

Playing around with Tweener
has only used TweenLite before
but seems to be kind of similar.

I think I'll add in a little
colortransformations and stuff
but now it's time to get to bed.

@author Tommislav
@version 0.1
Get Adobe Flash player
by tommysalo 03 Feb 2009
package {
    import flash.display.*;
    import flash.text.*;

    import caurina.transitions.Tweener;
    
    
    /**
    *    Playing around with Tweener
    *    has only used TweenLite before
    *    but seems to be kind of similar.
    *
    *    I think I'll add in a little
    *    colortransformations and stuff
    *    but now it's time to get to bed.
    *
    *    @author Tommislav
    *    @version 0.1
    */    


    
    public class TextFlow extends Sprite {
        
        public const TEXT:String = "wonderFL  flow";
   
        private var _arr:Array;
        private var _tf:TextFormat;


        public function TextFlow() {
            // write as3 code here..
            init();
        }


        public function init():void
        {
            _arr = new Array();

            _tf = new TextFormat( "verdana", 40 );
            _tf.bold = true;
            
            var tempWidth:Number = 0; // keep track of width for repositioning
            


            for ( var i:int = 0; i < TEXT.length; i++ )
            {
                var letter:TextField = new TextField();
                letter.autoSize = "left";
                letter.text = TEXT.charAt(i);
                letter.setTextFormat( _tf );
                
                letter.y = stage.stageHeight * .5 - letter.height * .5;
                tempWidth += letter.width;

                _arr.push( letter );
                addChild( letter );
            }
             
            // We need one more loop to reposition in x-axis
            var leftX:Number = 0;
            for ( i=0; i < _arr.length; i++ )
            {
                _arr[i].x = stage.stageWidth * 0.5 - tempWidth * 0.5 + leftX;
                leftX += _arr[i].width;
                moveAgain( _arr[i] );
            }
        }

        
        private function moveAgain( txt:TextField ):void
        {
            var x:Number = Math.random() * 60 - 30;
            var y:Number = Math.random() * 60 - 30;
            var rX:Number = Math.random() * 90 - 45;
            var rY:Number = Math.random() * 90 - 45;
            var len:Number = Math.random() * 6 + 2;

            Tweener.addTween( txt, { x:txt.x + x, y:txt.y+y, rotationX:rX, rotationY:rY, time:len, transition:"easeInOutSine", onComplete:moveAgain, onCompleteParams:[txt] } );
        }

    }




    
}