# Problem creating rotating xml content

**URL:** <https://forum.kirupa.com/t/problem-creating-rotating-xml-content/242712>\
**Category:** Uncategorized\
**Created:** [October 29, 2007, 6:25pm UTC](https://forum.kirupa.com/t/problem-creating-rotating-xml-content/242712 "2007-10-29T18:25:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluesheep](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bluesheep/32/3544_2.png) [@bluesheep](https://forum.kirupa.com/u/bluesheep)\
**Post date:** [October 29, 2007, 6:25pm UTC](https://forum.kirupa.com/t/problem-creating-rotating-xml-content/242712/1 "2007-10-29T18:25:49Z")

</div>

I’m trying to load testimonial text via xml and then have the testimonials fade in and out, one by one, and start over at the beginning when the last one fades out. Parsing the xml works just fine, heres the AS for reference:

var newXML = “whoWeAre.xml”;

var my\_xml = new XML();  
my\_xml.ignoreWhite = true;  
my\_xml.onLoad = function(success) {  
// has XML loaded  
if (success) {

```
    // testimonais //
    _global.quotes = [];
    _global.quoteAuthors = [];
    _global.quoteNotes = [];
    _global.quoteNumber = new Array();
    var quoteInfo = my_xml.firstChild.childNodes[1].childNodes;
    var itemCount = 0;
    var yCount = 0;
    
    for (var i = 0; i&lt;quoteInfo.length; i++) {
        _root.mcStage.mcCenter.content.quoteHolder.i = i;
        _root.mcStage.mcCenter.content.quoteHolder.totalLength = quoteInfo.length;
        _global.quotes* = quoteInfo*.attributes.text;
        _global.quoteAuthors* = quoteInfo*.attributes.author;
        _global.quoteNotes* = quoteInfo*.attributes.note;
        var quote_mc = _root.mcStage.mcCenter.content.quoteHolder.attachMovie("quote_mc", "quote_mc"+itemCount, itemCount);
        quote_mc.quote.text = _global.quotes*;
        quote_mc.author.text = _global.quoteAuthors*;
        quote_mc.note.text = _global.quoteNotes*;
        var quoteFormat:TextFormat = quote_mc.quote.getTextFormat()
            quoteFormat.letterSpacing = 0.25;
            quote_mc.quote.setTextFormat(quoteFormat);
            quote_mc.quote.setNewTextFormat(quoteFormat);
        var authorFormat:TextFormat = quote_mc.author.getTextFormat()
            authorFormat.letterSpacing = 0.25;
            quote_mc.author.setTextFormat(authorFormat);
            quote_mc.author.setNewTextFormat(authorFormat);
        var noteFormat:TextFormat = quote_mc.note.getTextFormat()
            noteFormat.letterSpacing = 0.25;
            quote_mc.note.setTextFormat(noteFormat);
            quote_mc.note.setNewTextFormat(noteFormat);
        quote_mc.quote._height = quote_mc.quote.textHeight + 8;
        quote_mc.author._height = quote_mc.author.textHeight + 5;
        quote_mc.author._y = quote_mc.quote._height + 22;
        quote_mc.note._y = quote_mc.author._y + quote_mc.author._height;
        quote_mc._y = 0;
        quote_mc._x = -10;
        quote_mc._alpha = 0;
        itemCount++;
        _global.quoteNumber.push(i);
        }
}

```

}

Now here is are separate functions to find the max number of quotes and to create the fade in/out and loops when the last one is reached:

// function to find max value in array (used below)  
function maxValue(array) {  
mxm = Number(array[0]);  
for (i = 0; i \< array.length - 1; i++) {  
if (array\* \> mxm) {  
mxm = array\*;  
}  
}  
return mxm;  
}  
// function to fade quotes  
var fadeDelay = 2;  
var whichQuote = 0;  
fadeQuote = function() {  
// check to see if we should start number over  
if (whichQuote \> maxValue(\_global.quoteNumber)) {  
whichQuote = 0;  
}  
// do the fade

\_root.mcStage.mcCenter.content.quoteHolder[“quote\_mc”+whichQuote].alphaTo(100, .5, “linear”, fadeDelay);  
\_root.mcStage.mcCenter.content.quoteHolder[“quote\_mc”+whichQuote].xSlideTo(0, .5, “easeOutCubic”, fadeDelay);  
\_root.mcStage.mcCenter.content.quoteHolder[“quote\_mc”+whichQuote].alphaTo(0, .35, “linear”, fadeDelay + 2.75);  
\_root.mcStage.mcCenter.content.quoteHolder[“quote\_mc”+whichQuote].xSlideTo(10, .5, “easeOutCubic”, fadeDelay + 2.75, function() {  
// bump up quote number for next run through  
whichQuote += 1;  
fadeQuote();

```
} );

```

}

//start the quote fade  
fadeQuote();

The problem is \_root.mcStage.mcCenter.content.quoteHolder[“quote\_mc”+whichQuote] traces undefined as does a straightforward reference like \_root.mcStage.mcCenter.content.quoteHolder.quote\_mc0

a trace of [“quote\_mc”+whichQuote] is successful, so I know that is working, and I’m sure the path to quote\_mc is correct as you can see it’s identical to the above where the movie clip was created.

Everything seems like it should work, but it just doesn’t. Can someone help me out?
