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

forked from: forked from: FontLoaderを使ってMinimalCompsで日本語表示

/**
 * Copyright bkzen ( http://wonderfl.net/user/bkzen )
 * GNU General Public License, v3 ( http://www.gnu.org/licenses/quick-guide-gplv3.html )
 * Downloaded from: http://wonderfl.net/c/6d37
 */

// forked from bkzen's forked from: FontLoaderを使ってMinimalCompsで日本語表示
// forked from Fake's FontLoaderを使ってMinimalCompsで日本語表示
package {
    import flash.text.TextFormat;
    import flash.events.Event;
    import flash.display.Sprite;
    import com.bit101.components.Text;
    import net.wonderfl.utils.FontLoader;
    import com.bit101.components.Style;
    import com.bit101.components.PushButton;
    import com.bit101.components.Label;

    public class FlashTest extends Sprite {
        private var fontname:String = "Cinecaption";
        private var debugout:Text;

        public function FlashTest() {
            // write as3 code here..
            debugout = new Text(this, 50, 50, "Now loading...");
            var floader:FontLoader = new FontLoader();
            floader.addEventListener(Event.COMPLETE, function (e:Event):void {
                debugout.textField.defaultTextFormat = new TextFormat(fontname, 12);
                debugout.text = "こんなやり方で大丈夫か?\n";
                Style.embedFonts = false;
                Style.fontName = fontname
                Style.fontSize = 12;
                var btn:PushButton = new PushButton(parent, 50, 180, "大丈夫だ、問題ない");
                btn.setSize(150, 20);
                var label:Label = new Label(parent, 50, 220, "一番いいフォントを頼む");
                label.text = "" + label.textField.getTextFormat().font;
                
            });
            floader.load(fontname);
        }
    }
}