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

FontLoader

thanks to the free font authors!
/**
 * Copyright mash ( http://wonderfl.net/user/mash )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4tnW
 */

// thanks to the free font authors!
package {
    import flash.events.*;
    import flash.text.*;
    import flash.display.*;
    import net.wonderfl.utils.FontLoader;

    public class FlashTest extends Sprite {
        public function FlashTest() {
        	    Wonderfl.capture_delay(30);
        	
            var offset :int = 0;
            
            var fonts :Array = ["Aqua","Azuki","Cinecaption","Mona","Sazanami","YSHandy","VLGothic","IPAGP","IPAM","UmeUgo","UmePms","Bebas"];
            fonts.forEach( function( font :String, i:int, a:Array ) :void {
                var loader :FontLoader = new FontLoader;
                loader.load( font );
                loader.addEventListener( Event.COMPLETE, function(e :Event) :void {
                    var tf :TextField = fontedTextField( font );
                    tf.y = offset;
                    addChild( tf );

                    offset += 30;
                });
            });
        }

        private function fontedTextField( font :String ) :TextField {
            var tf :TextField = new TextField;
            tf.defaultTextFormat = new TextFormat( font, 22, 0x000000 );
            tf.embedFonts = true;
            tf.width = 465;
            tf.text = font + ": Hello, World! こんにちは、世界!";
            return tf;
        }
    }
}