# Scripted typewriter effect and html formatting

**URL:** <https://forum.kirupa.com/t/scripted-typewriter-effect-and-html-formatting/221927>\
**Category:** Uncategorized\
**Created:** [April 9, 2007, 2:09pm UTC](https://forum.kirupa.com/t/scripted-typewriter-effect-and-html-formatting/221927 "2007-04-09T14:09:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)\
**Post date:** [April 9, 2007, 2:09pm UTC](https://forum.kirupa.com/t/scripted-typewriter-effect-and-html-formatting/221927/1 "2007-04-09T14:09:00Z")

</div>

i’m passing some text into a dyn text field and using the following code to create a sort of typewriter effect on the type. the problem is that when the code encounters my \<a href=’’\> tags it;  
A. doesn’t format/render the html text/hyperlink  
B. Stalls for several seconds as it processes the \<a href\> tag

I’m wondering if there’s a way to modify what i have here to accomodate the tags better and still get a nice smooth typewriter effect?

My hyperlinks work fine if i lose the typewriter effect and just assign the html text to a textbox… My other html tags (bold, etc.) seem to work fine with the typewriter effect, it’s just the hyperlink.

any help would be appreciated!

```auto
stop();

dateText.html=true;

var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.onLoad = function(success:Boolean):Void {
    if (success) {
		trace("oh snap!");
        // display style names.
        trace(this.getStyleNames());
		
		dateText.styleSheet=styles;
    } else {
        trace("Error loading CSS file.");
    }
};
styles.load("styles.css");

myCal.onDateClick=function(mc,eobj,robj)
 {
var tbx:String=eobj.content;

typeIt(tbx);
 }

typeIt = function(tbx){
 text = tbx;
 l = text.length;
 p = 1;
 function spelltext() {
dateText.html=true;
dateText.styleSheet=this._parent.styles;
dateText.htmlText = text.substring(0, p);
 p++;
 if (p == l+1) {
 clearInterval(write);
 }
 }
 write = setInterval(spelltext, 30);
}

```
