Hi! I had an onEnterFrame script that would make a cypher of some letters for you. I thought it would be great if I could wrap the code in a function so I could apply it to multiple textboxes at once. Since doing it (wrong!) it only actually does what its supposed to on one of the textboxes. What am I doing wrong?

To make this work you'll need a two textboxes, one with an instance name of text_one and one called text_two

Actionscript Code:
// The String that will reveal itself
cypher_characters("text_one", 10, 5, 2, text_one);
cypher_characters("text_two", 10, 5, 2, text_two);


function cypher_characters(characters, time_until_start, time_between, frequency, textbox)
{
    var mc = _root.createEmptyMovieClip(textbox + "clip",1);
    // chop up that string into an array
    var characters_array = characters.split("");
    // measure the length
    var char_len = characters_array.length;
   
    // create an array of timings based on the variables given earlier
    var timings = [];
    for (var i = 0; i < char_len; i++)
    {
        timings.push(time_until_start + (time_between * i));
    }
   
    // The array that will hold all the letters and timings
    var all = [];
   
    for (var i = 0; i < char_len; i++)
    {
        // pair off each character with the a timing from the arrays we've made :)
        all[i] = [characters_array[i], timings[i]];
    }
   
    var count = 0;
   
    mc.onEnterFrame = function(){
        count ++
        if(count > frequency)
        {
            count = 0;
            number_finished = 0;
            // for all our letters
            len = all.length;
            for (var i = 0; i < len; i++)
            {
                // if they have finished randoming (with 5 frames of 'padding')
                if(all[i][1] < -5)
                {
                    // add to total finished
                    number_finished += 1;
                };
            }
            // if the number of finished animations = the number of letters
            if(number_finished == len)
            {
                trace("(finished)");
                // stop doing this
                delete mc.onEnterFrame;
            }
            else
            {
                // otherwise shred the cycle function
                cycle(textbox);
            }
        }
    }
   
    function cycle(textbox){
        // clear the output
        output_string = "";
        // for all the items in the array
        for (var i = 0; i < len; i++) {
            // take away one from the number of frames to random
            all[i][1] --;
           
            // if the number of frames to random is still greater than 0
            if(all[i][1] > 0){
                // append a random number
                output_string += Math.ceil(Math.random()*9);
            }
            else{
                // must have run out of frames, append the letter specified
                output_string += all[i][0];
            }
        }
        // fill the textbox with the output
        textbox.text = output_string;
    }
}

Thanks for any help!