flash on 2011-9-22
♥0 |
Line 25 |
Modified 2011-09-22 16:20:17 |
MIT License
archived:2017-03-20 03:03:17
ActionScript3 source code
/**
* Copyright fujiopera ( http://wonderfl.net/user/fujiopera )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/insJ
*/
package {
import flash.display.Sprite;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.factory.TextFlowTextLineFactory;
import flash.geom.Rectangle;
import flash.text.engine.TextLine;
import flashx.textLayout.elements.TextFlow;
public class FlashTest extends Sprite {
var myFlow:TextFlow = new TextFlow();
public function FlashTest() {
// TextFlowオブジェクトの生成と構造化
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
span.text = "Hello, World";
paragraph.addChild(span);
myFlow.addChild(paragraph);
// TextFlowオブジェクトからTextLineオブジェクトを生成
var factory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
factory.compositionBounds = new Rectangle(100, 100, 200, 25);
factory.createTextLines(onCreateTextLines, myFlow);
// コールバック関数: 生成されたTextLineオブジェクトの処理
function onCreateTextLines(myTextLine:TextLine):void {
addChild(myTextLine);
}
// write as3 code here..
}
}
}