Ver Mensaje Individual
  #4 (permalink)  
Antiguo 09/08/2006, 08:42
Avatar de goc00
goc00
 
Fecha de Ingreso: enero-2002
Ubicación: 000's DiMensiOn
Mensajes: 979
Antigüedad: 22 años, 3 meses
Puntos: 3
Saludos:

Investigando más exhaustivamente por la red, encontré la solución
Efectivamente se utiliza la método NO DOCUMENTADO (¿qué mal eso no?) condenseWhite. La "restricción" de dicho método es que sirve para TextField del tipo htmlText, pero gracias a un prototype de la clase TextField podemos utilizarlo en cualquier campo de texto (entiéndase tipo). Les dejo la solución porque a más de alguno le servirá

Código:
TextField.prototype.addProperty("text2", function () {
	return this.text;
}, function (txt) {
	if (!this.condenseWhite) {
		this.text = txt;
		return;
	}
	for (var i = 0; i<txt.length; i++) {
		if (txt.charCodeAt(i)>32) {
			txt = txt.substring(i);
			break;
		}
	}
	for (var i = 0, t = ""; i<txt.length; i++) {
		if (txt.charCodeAt(i)>32) {
			t += txt.charAt(i);
		} else {
			if (i != 0 && txt.charCodeAt(i+1)>32) {
				t += txt.charAt(i);
			}
		}
	}
	this.text = t;
});
Y para que vean que funciona muy bien:

Código:
tuTextField.condenseWhite = true;
tuTextField.text2 = "      cadena   con muchos    espacios  inservibles ";
trace(tuTextField.text2);
Me sirvió demasiado esto, seguro que a ustedes también
__________________
GOC00 CominG soOn v2.0
CyA! & GooD LuCK...