[AS3] Stacking Multiline Textboxes eg

paste onto a frame


var pastTF:TextField;
var vSpace:Number = 5;
var yVal:Number;

function init (num:Number):void {
	for (var i:Number = 0; i < num; i++) {
		var sampleText:TextField = new TextField();
		sampleText.width = 250;
		sampleText.autoSize = TextFieldAutoSize.LEFT;
		sampleText.multiline = true;
		sampleText.wordWrap = true;
		sampleText.border = true;
		sampleText.text = inserRandomText ();

		i>0 ? yVal =  vSpace + pastTF.height + pastTF.y: yVal=0;
		sampleText.y = yVal;

		addChild (sampleText);
		pastTF = sampleText;
	}
}

function inserRandomText ():String {
	var len:Number = Math.random()*50;
	var str:String = new String();
	for (var n=0; n<len; n++) {
		str += "hello ";
	}
	return str;
}

init(20);