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

fontFamily

フォントファミリーを用いたテキストの表示。
ただし、英字フォントと日本語フォントで別々のフォントを用いるとか器用なことはできません。
Get Adobe Flash player
by shohei909 22 May 2011
/**
 * Copyright shohei909 ( http://wonderfl.net/user/shohei909 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uUj2
 */

package {
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.FontDescription;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.TextLine;
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    import org.libspark.ukiuki.Ukiuki;
    public class FlashTest extends Sprite {
        // カンマ区切りでフォントを指定します。
        private var fontFamily:String = "うずらフォント,あずきフォント,ヒラギノ角ゴ Pro W3,メイリオ,MS PGothic,MS Gothic,Osaka,_typewriter"
        private var font:FontDescription = new FontDescription( fontFamily );
        private var format:ElementFormat = new ElementFormat( font, 110 );
        private var text:TextElement = new TextElement( "Hello,\nfont\nfamily!!", format );
        
        function FlashTest() {
            var block:TextBlock = new TextBlock( text )
            var line:TextLine = block.createTextLine()
            var ly:Number = 0; 
            while( line ){
                ly += line.height;
                line.y = ly - 10;
                line.x = 45;
                line.rotation = 5;
                addChild( line );
                
                Ukiuki.random( line, { x:1, y:1, rotation:0.15 }, { skipUpdates:2 } );
                
                line = block.createTextLine( line );
            }
            
            this.rotation = 5;
        }
        
    }
}