TLF
TLFが入っていたようなので学ぶ
/**
* Copyright demouth ( http://wonderfl.net/user/demouth )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8sIk
*/
//TLFが入っていたようなので学ぶ
package {
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.text.TextField;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.ConversionType;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.edit.EditingMode;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.SelectionManager;
import flashx.textLayout.edit.TextFlowEdit;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.BlockProgression;
import flashx.textLayout.formats.JustificationRule;
public class FlashTest extends Sprite {
public var text:TextField;
public function FlashTest() {
// write as3 code here..
//Spriteを作成
var sprite:Sprite = new Sprite();
this.addChild(sprite);
sprite.x = 0;
sprite.y = 0;
//Elementを作成
var flow:TextFlow = new TextFlow();
var p:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
span.text = "Text Layout Framework";
span.fontSize = 100;
p.addChild(span);
flow.addChild(p);
//縦書きにする
flow.justificationRule = JustificationRule.EAST_ASIAN;
flow.blockProgression = BlockProgression.RL;
//ユーザー操作可能にする
flow.interactionManager = new EditManager();
//表示
flow.flowComposer.addController(new ContainerController(sprite , 465, 300));
flow.flowComposer.updateAllControllers();
//XMLとして出力
var xml:XML = TextConverter.export(flow , TextConverter.TEXT_LAYOUT_FORMAT , ConversionType.XML_TYPE) as XML;
this.addChild(this.text = new TextField());
text.width = 465;
text.y = 300;
text.text = xml.toString();
}
}
}