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

Trying out TextAnim

Get Adobe Flash player
by tommysalo 21 Apr 2010
/**
 * Copyright tommysalo ( http://wonderfl.net/user/tommysalo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/sdsN
 */

package {
	import net.wonderfl.utils.FontLoader;
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    import flupie.textanim.*;
    import flupie.textanim.TextAnim;
    import flupie.textanim.TextAnimBlock;
    import gs.TweenLite;
    
    import flash.text.engine.TextBlock;
    import flash.events.Event;
    import flash.display.StageScaleMode;
    public class FlashTest extends Sprite {
    		
    		public const USE_FONT:String = "YSHandy";
    		
        public function FlashTest() {
            // write as3 code here..
            stage.scaleMode = StageScaleMode.NO_SCALE;
            
            var ldr:FontLoader = new FontLoader();
            ldr.addEventListener( "complete", function onLoaded(e:Event):void {
            		
            		var tf:TextFormat = new TextFormat();
	           	tf.font = USE_FONT;
	           	tf.size = 18;
	           	tf.bold = true;
	            
	            var txt:TextField = new TextField();
	            txt.autoSize = "left"; 
	            txt.defaultTextFormat = tf;
	            txt.embedFonts = true;
	            txt.text = "Testing with textanim lib\nYaay, loaded a font with \nnet.wonderfl.utils.FontLoader =D";
	            
	            txt.x = txt.y = 50;
	            
	            addChild(txt);
	            
	            var myTextAnim:TextAnim = new TextAnim(txt);
	            myTextAnim.effects = myEffect;
	            myTextAnim.blocksVisible = true;
				myTextAnim.start();
            	});
            	
            ldr.load(USE_FONT);
            
        }
        
        private function myEffect( block:TextAnimBlock ):void
        {
			TweenLite.from( block, 2, { scaleY:6, rotation:360 } );
        	}
    }
}