var txt:TextField = TextField(addChild(new TextField()));
txt.text = "";
txt.width = 190;
txt.height = 400;
txt.multiline = true;
var count:int = 1;
function render():void{
var line = int(count).toString(2);
while(line.length < 31){
line = "0" + line;
}
txt.appendText(line + "n");
txt.scrollV= txt.maxScrollV;
}
addEventListener(Event.ENTER_FRAME, onCountUp);
function onCountUp(evt:Event):void {
count *= 2;
render();
if (count ==0x40000000){
removeEventListener(Event.ENTER_FRAME, onCountUp);
addEventListener(Event.ENTER_FRAME, onCountDown);
}
}
function onCountDown(evt:Event):void {
count /= 2;
render();
if (count ==1){
addEventListener(Event.ENTER_FRAME, onCountUp);
removeEventListener(Event.ENTER_FRAME, onCountDown);
}
}
The above animates a zig zag pattern in a TextField.