# Flash and XML having problems Undefined

**URL:** <https://forum.kirupa.com/t/flash-and-xml-having-problems-undefined/173253>\
**Category:** Uncategorized\
**Created:** [December 22, 2005, 6:41pm UTC](https://forum.kirupa.com/t/flash-and-xml-having-problems-undefined/173253 "2005-12-22T18:41:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![squarepiece](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@squarepiece](https://forum.kirupa.com/u/squarepiece)\
**Post date:** [December 22, 2005, 6:41pm UTC](https://forum.kirupa.com/t/flash-and-xml-having-problems-undefined/173253/1 "2005-12-22T18:41:08Z")

</div>

I am trying to understand how to use XML with flash and I am trying to make this random quote generator work. Here is the code in the first key frame and on the stage is a textbox titled quotebox. I don’t get any errors with the code but when I export the movie the flash side seems to work, but it’s not loading the xml file, it states UNDEFINED in the swf.

I am thinking it’s the xml file but i am not sure. Additionally, I would like the quote to stay at alpha 100 for an interval of time, but i think i am missing something for that to take place. And would this work if i put it inside of a movie clip or does it have to be on the main timeline.

I would really appreciate any help, thank you.

> trace(escape(‘" '’));  
> xml = new XML();  
> xml.ignoreWhite = true;  
> xml.load(‘quotes.xml’);  
> xml.onLoad = function() {  
> quotes = new Array();  
> copyQuotes = new Array();  
> trace(xml.firstChild);  
> for (q=0; q\<xml.firstChild.childNodes.length; q++) {  
> trace(xml.firstChild.childNodes.childNodes.join(‘’));  
> quotes = unescape(xml.firstChild.childNodes.childNodes.join(‘’).split(’  
> ‘).join(’  
> ‘).split(’‘).join.split(’'‘).join(’'));  
> }  
> copyQuotes = copyQuotes.concat(quotes);  
> fmt = new TextFormat();  
> fmt.font = ‘myFont’;  
> quotebox.setNewTextFormat(fmt);  
> quotebox.embedFonts = true;  
> quotebox.multiline = true;  
> quotebox.wordWrap = true;  
> quotebox.autoSize = ‘center’;  
> quotebox.\_alpha = 0;  
> quotebox.dir = 1;  
> quotebox.speed = 0;  
> quotebox.qnum = random(copyQuotes.length);  
> function fla() {  
> quotebox.text = quotes[quotebox.qnum];  
> quotebox.\_alpha += ((quotebox.speed += .1)\*quotebox.dir);  
> if (quotebox.\_alpha\>=100) {  
> quotebox.\_alpha = 100;  
> quotebox.speed = 1;  
> quotebox.dir = -1;  
> } else if (quotebox.\_alpha\<=-100) {  
> copyQuote.splice(quotebox.qnum, 1);  
> quotebox.qnum = random(copyQuotes.length);  
> quotebox.\_alpha = 0;  
> quotebox.speed = 0;  
> quotebox.dir = 1;  
> }  
> if (copyQuotes.length == 0) {  
> copyQuotes = copyQuotes.concat(quotes);  
> }  
> updateAfterEvent();  
> }  
> setInterval(fla,25);  
> };

Here is the code inside of the XML file.

> \<?xml version=“1.0”?\>

\<quotes\>  
\<fquotes\>Test 1\</fquotes\>  
\<fquotes\>Test2\</fquotes\>  
\</quotes\>

Thanks again, any help would be appreciated. 😉
