TypeWriting Effect with Columns Diagraming prototype

Hi folks!

I’ve been playing with a way to do a typewriting Effect that creates a new column of text every time the textField reachs it’s maxscroll>1 value.

Here is some code for that, i’ve probed this in the fla file **(columnas.zip) **that’s attached to this post:


//
var contador:Number = 0;
var mitexto:String = "Long text files often consist of many subsections that can be considered to be separate documents. For example, some email programs keep messages in a single long text file, with a marker such as Date: or a line of dashes separating the messages. Also, XML files with data converted from a database table will typically contain a series of records. The File Segmentation Rules feature in dtSearch provides a way to tell dtSearch to index each message or record as a separate document, without breaking up the original text file into numerous tiny files. For each rule, a filename filter determines which files the rule applies to. If more than one rule could apply to a particular file, the first one to match the filename is the one applied. A rule that does not have have a filter will be ignored.";
var auxiText:String = mitexto;
//
w = 180	;
h = 200;
//
MovieClip.prototype.escribidor2 = function(texto:String, velocidad:Number):Void  {
	//
	this.textoMio = texto;
	//
	this.largo = texto.length;
	//
	this.ini = 0;
	this.newt = 0;
	this.fee = this.largo;
	this.final = velocidad;
	//
	this.caractNum = 0;
	//
	this.cubic = function(t:Number, b:Number, c:Number, d:Number):Number  {
		var ts:Number = (t /= d)*t;
		var tc:Number = ts*t;
		return b+c*(tc+-3*ts+3*t);
	};
	//
	this.onEnterFrame = function() {
		if (this.ini<=this.final) {
			this.caractNum = Math.round(this.cubic(this.ini, this.newt, this.fee, this.final));
			this.newtext = this.textoMio.substr(0, this.caractNum);
			//
			this.textfield_txt.htmlText = this.newtext;
			//
			this.ini++;
			//
			//
			if (this.textfield_txt.maxscroll == 2) {
				delete this.onEnterFrame;
				this.textfield_txt._height = h+16;
				auxiText = mitexto.substring(this.caractNum);
				duplicameT();
			}
		} else {
			delete this.onEnterFrame;
		}
	};
	//
};
//
duplicameT = function ():Void {
	//	
	texto.duplicateMovieClip("texto"+contador, contador);
	this["texto"+contador].textfield_txt._width = w;
	this["texto"+contador].textfield_txt._height = h;
	this["texto"+contador]._x = 10+((this["texto"+contador]._width+15)*contador);
	this["texto"+contador].escribidor2(auxiText, 25);
	contador++;
	//
	texto._visible = false;
};
//
duplicameT();
//


So, first i’ve made the same prototype that i use to type text with easing in my sites, then i check inside the enterFrame() to the reach of the maxscroll, if it’s higher than one i stop the enterFrame() and recall the function with an increment of one in contador, that makes another copy of my MovieClip and shift it by the width of the last copy + 20 px, i did a little teak because i have found that when i’m checking for maxscroll the typewriting stop but, it writes another line before duplicate a new instance of text and that line keeps hide in the textfield, so i adds like 16–>20 px to it’s height property before creating a new one.

I have doubts, because i need to know how in hell i can get “no breaking words” at the end of the textfield before passing to the next column?.. also anyone can help me figure it out why when i play with h and w (heigth and width of the textField) sometimes get in a infinite loop and creates new instances of the last column forever?

Feel free to use it…and improve it also i’m working in the V2 of my wordpress blog connnected with a flash GUI.

Thx a lot to the ones who read this, and help me!