CS4 condenseWhite in textField using action script

Posted by druva | Flash, as3, utils | Tuesday 29 December 2009 8:07 am

The condenseWhite means removing extra spaces and html tags like \n,\t.


import fl.controls.*;

var checkBox:CheckBox = new CheckBox();
checkBox.label = "condenseWhite";
checkBox.labelPlacement = ButtonLabelPlacement.RIGHT;
checkBox.addEventListener(Event.CHANGE, checkBox_action);
checkBox.move(20,5);
checkBox.width = 150;
addChild(checkBox);

var tf:TextField = new TextField();
tf.x = 20;
tf.y = 30;
tf.width = tf.height = 250;

function checkBox_action(evt:Event):void {
	tf.condenseWhite = checkBox.selected;
	tf.htmlText = "http://   \n\t  blog.totusinfo.com";

}
addChild(tf);