# Loading random XML quote..trying to anyway

**URL:** <https://forum.kirupa.com/t/loading-random-xml-quote-trying-to-anyway/252023>\
**Category:** flash\
**Created:** [February 14, 2008, 11:46pm UTC](https://forum.kirupa.com/t/loading-random-xml-quote-trying-to-anyway/252023 "2008-02-14T23:46:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackieMoon](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@JackieMoon](https://forum.kirupa.com/u/JackieMoon)\
**Post date:** [February 14, 2008, 11:46pm UTC](https://forum.kirupa.com/t/loading-random-xml-quote-trying-to-anyway/252023/1 "2008-02-14T23:46:05Z")

</div>

What am I missing?? I am trying to randomly load a simple quote from an xml file. Here is my AS:

```auto

var aQuotes:Array = new Array();
var xmlQuotes:XML;

getQuotes("quotes2.xml");

function getQuotes(sURL:String):Void{
    xmlQuotes = new XML();
    xmlQuotes.ignoreWhite = true;
    xmlQuotes.onLoad = function(bSucces:Boolean){
        if(bSuccess){
            for (var i:Number = 0; i < this.firstChild.childNodes.length; i++){
                aQuotes.push(this.firstChild.childNodes*.firstChild.nodeValue);
                
            }
            initializeQuotes();
        }
    };
    xmlQuotes.load(sURL);
    
            
}

function randomInteger(nRange:Number):Number{
    var nRandomFloat:Number = Math.random() * nRange;
    var nRandomInteger:Number = Math.floor(nRandomFloat);
    return nRandomInteger;
}

function initializeQuotes():Void {
    var sQuotes:String = aQuotes[randomInteger(aQuotes.length)];
    trace(sQuotes);
    
    
    

}

```

and then here is my xml:

```auto

<randomquotes>
    <quote>Hello</quote>
    <quote>Goodbye</quote>
    <quote>See ya later</quote>
</randomquotes>

```

I can’t figure this out. Probably because I really don’t know what I am doing. Thanks for any help you can give me.
