「Flex/FontList」の編集履歴(バックアップ)一覧はこちら
Flex/FontList - (2014/06/27 (金) 20:56:11) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
|開発環境|Apache Flex SDK 4.12.1|
||FlashDevelop 4.6.2.5|
|実行環境|Microsoft Windows 8.1 (64bit)|
|プロジェクトの種類|ActionScript 3/AS3 Project|
|プロジェクト名|FontList|
#table_zebra(project, #fff, #eee)
http://www.maroon.dti.ne.jp/lance/flash/fontlist.html
Main.as
#highlight(actionscript){{
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.text.Font;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Keyboard;
public class Main extends Sprite
{
private var textField:TextField = new TextField;
private var tflist:Array = new Array(10);
private var fonts:Array = Font.enumerateFonts(true);
private var pages:int = Math.ceil(fonts.length / 10);
private var page:int = 0;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
textField.x = 10;
textField.y = 10;
textField.width = 200;
textField.height = 30;
textField.defaultTextFormat = new TextFormat(null, 24);
addChild(textField);
for (var i:int = 0; i < 10; i++)
{
var tf:TextField = new TextField;
tf.x = 10;
tf.y = 50 + 40 * i;
tf.width = 480;
tf.height = 35;
tf.border = true;
addChild(tf);
tflist[i] = tf;
}
disp();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
}
private function disp():void
{
textField.text = "← → page " + (page + 1) + " / " + pages;
for (var i:int = 0; i < 10; i++)
{
var index:int = page * 10 + i;
if (index < fonts.length)
{
var fontName:String = fonts[index].fontName;
tflist[i].defaultTextFormat = new TextFormat(fontName, 24);
tflist[i].text = "012 ABC 漢字 " + fontName;
}
else
{
tflist[i].text = "";
}
}
}
private function onKeyDown(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.LEFT:
if (--page < 0) page = pages - 1;
disp();
break;
case Keyboard.RIGHT:
if (pages <= ++page) page = 0;
disp();
break;
}
}
}
}
}}
|開発環境|Apache [[Flex]] SDK 4.12.1|
||FlashDevelop 4.6.2.5|
|実行環境|Microsoft Windows 8.1 (64bit)|
|プロジェクトの種類|ActionScript 3/AS3 Project|
|プロジェクト名|FontList|
#table_zebra(project, #fff, #eee)
http://www.maroon.dti.ne.jp/lance/flash/fontlist.html
Main.as
#highlight(actionscript){{
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.text.Font;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Keyboard;
public class Main extends Sprite
{
private var textField:TextField = new TextField;
private var tflist:Array = new Array(10);
private var fonts:Array = Font.enumerateFonts(true);
private var pages:int = Math.ceil(fonts.length / 10);
private var page:int = 0;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
textField.x = 10;
textField.y = 10;
textField.width = 200;
textField.height = 30;
textField.defaultTextFormat = new TextFormat(null, 24);
addChild(textField);
for (var i:int = 0; i < 10; i++)
{
var tf:TextField = new TextField;
tf.x = 10;
tf.y = 50 + 40 * i;
tf.width = 480;
tf.height = 35;
tf.border = true;
addChild(tf);
tflist[i] = tf;
}
disp();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
}
private function disp():void
{
textField.text = "← → page " + (page + 1) + " / " + pages;
for (var i:int = 0; i < 10; i++)
{
var index:int = page * 10 + i;
if (index < fonts.length)
{
var fontName:String = fonts[index].fontName;
tflist[i].defaultTextFormat = new TextFormat(fontName, 24);
tflist[i].text = "012 ABC 漢字 " + fontName;
}
else
{
tflist[i].text = "";
}
}
}
private function onKeyDown(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.LEFT:
if (--page < 0) page = pages - 1;
disp();
break;
case Keyboard.RIGHT:
if (pages <= ++page) page = 0;
disp();
break;
}
}
}
}
}}