How to?:text effect funtion when loading xml

Hi All,

I’m strugling for 2 days to get this to work…i’ve seen and searched all the forums
around in 3 languages but no luck…

I have this very nice text effect function (it is exactly like the g94 typewriter…),
and i want it to work when loading my text through xml.

the following is going on…


function displayText(target_txt:TextField, displayText:String)
    {
        var _this:Object = this;
        
        var styles:TextField.StyleSheet = new TextField.StyleSheet(); 
        
        styles.setStyle(".oldStyle", 
        {fontFamily: "Verdana_embed", 
        fontSize: "11px", 
        color: "#888888",
        align: "justify",
        leading: 4}
        )
        
        styles.setStyle(".newStyle", 
        {fontFamily: "Verdana_embed", 
        fontSize: "11px", 
        color: "#000000",
        align: "justify",
        leading: 4}
        )

        target_txt.styleSheet = styles;
        
        var oldLength:Number = displayText.length;
        var newLength:Number = displayText.length;        
        
        var i:Number = newLength
        var j:Number = oldLength
        
        var tempNew:String= ""; 
        var tempOld:String= "";
        
        var c:Number=0;
        
        target_txt._parent.onEnterFrame =  function()
        {
            var newX:Number = Math.ceil(0.3 * newLength); 
            newLength -= newX;
            tempNew = displayText.substr(newLength,i);
            
            var oldX:Number = Math.ceil(0.15 * oldLength)
            oldLength -= oldX
            tempOld = displayText.substr(0, oldLength)
            
            if(oldLength == 0)
            {
                
                if(c == 6)
                {
                    var styles:TextField.StyleSheet = new TextField.StyleSheet(); 
                    
                    styles.setStyle(".oldStyle", 
                    {fontFamily: "Verdana_embed", 
                    fontSize: "11px", 
                    color: "#888888",
                    align: "justify",
                    leading: 4}
                    )
                    
                    styles.setStyle (".newStyle", 
                    {fontFamily: "Verdana_embed", 
                    fontSize: "11px", 
                    color: "#000000",
                    align: "justify", 
                    leading: 4}
                    )
                    
                    styles.setStyle("a:link",
                    {fontFamily: "Verdana_embed", 
                    fontSize: "11px", 
                    color: "#FF0000",
                    align: "justify",
                    leading: 4}
                    )
                    
                    styles.setStyle ("a:hover",
                    {
                        textDecoration: "underline"}
                    )
                    
            
                    target_txt.styleSheet = styles; 
            
                    delete this.onEnterFrame;
                }
                else
                {
                    c++
                }
                
            }
    
            var outputString:String = "<span class=\"newStyle\">" + tempNew + "</span>" + "<span class=\"oldStyle\">" + tempOld + "</span>"; 
            
            target_txt.htmlText = outputString;
        }
    }

 [FONT=Courier New][LEFT]myXML = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000ff]XML[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

myXML.[COLOR=#0000ff]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR];
myXML.[COLOR=#0000ff]onLoad[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]

[COLOR=#808080]//how to go further?..and parse the string an texfield name through here?..[/COLOR]

  [COLOR=#000000]}[/COLOR];

myXML.[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];

[/LEFT]
[/FONT]

Some actionscript help is appreciated…:)!!

A~