# How to combine these scripts?

**URL:** <https://forum.kirupa.com/t/how-to-combine-these-scripts/263671>\
**Category:** flash\
**Created:** [June 18, 2008, 7:11am UTC](https://forum.kirupa.com/t/how-to-combine-these-scripts/263671 "2008-06-18T07:11:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cakeman](https://avatars.discourse-cdn.com/v4/letter/c/bc8723/32.png) [@Cakeman](https://forum.kirupa.com/u/Cakeman)\
**Post date:** [June 18, 2008, 7:11am UTC](https://forum.kirupa.com/t/how-to-combine-these-scripts/263671/1 "2008-06-18T07:11:36Z")

</div>

Hi I’m trying to get a value from a database and insert it in the “Random Letter Cycling Script” that can be found [here](http://www.tutorialadvisor.com/tutorials_view/Random_Letter_Cycling_2_0-1137.html)

I have created a php-file that gets the data from mysql and I can retreive it in flash and trace it correctly.

How can I get the value from the database to be assigned to the variable “name”.  
I have comment the code where I need the variable name to be assigned from the database. The fla is just one frame.

```auto

var myxml:XML = new XML();
//Declare XML variable

myxml.ignoreWhite=true;
//ignore any white space in xml file.

myxml.onLoad = function(){
var nodes = this.firstChild.childNodes;
for(i=0;i<nodes.length;i++){
    //add items into list component.
    mylist.addItem(nodes*.firstChild.nodeValue,i);
    name = nodes*.firstChild.nodeValue;
    trace (name);
}

}
//load php file.
myxml.load("http://www.mydomain.com/script.php");

```

This is the code that comes with the “Random cycling letter script”:

```auto

onClipEvent (load) {        
if (_name == "main") {

    
        trace (name);
//normaly you assign the name varible here like this -> name = "Whatever you want"
//How can I get the value from the database to be assigned to the variable name here?

        for (x=0; x<name.length; ++x) {
            this.duplicateMovieClip("let"+x, x);
            _parent["let"+x]._x += x*15;
            _parent["let"+x].endLetter = name.charAt(x);
        }
        _root.alphabet = "abcdefghijklmnopqrstuvwxyz 1234567890";
        _alpha = 0;

        
    } else {
        cycle = true;
    }

    
}

onClipEvent (enterFrame) {
            

    if (cycle) {
        if (this.letter == endLetter) {
            ++_root.count;
            cycle = false;
        } else {
            this.letter = _root.alphabet.charAt(random(_root.alphabet.length));

        }
    }
    

}

```

Please help!
