# Random XML into Flash problem

**URL:** <https://forum.kirupa.com/t/random-xml-into-flash-problem/242648>\
**Category:** Uncategorized\
**Created:** [October 29, 2007, 2:07am UTC](https://forum.kirupa.com/t/random-xml-into-flash-problem/242648 "2007-10-29T02:07:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlackShadow](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BlackShadow](https://forum.kirupa.com/u/BlackShadow)\
**Post date:** [October 29, 2007, 2:07am UTC](https://forum.kirupa.com/t/random-xml-into-flash-problem/242648/1 "2007-10-29T02:07:59Z")

</div>

Ok so short version of what I’ve got going on is I have a button on the stage. and when said button is pressed, a random quote from 24 items in my XML file will be inserted into a textbox in another movieclip.

I’m creating an empy mc, that when the button is pressed, an mc loads into it that looks like a cartoon chat bubble. this mc has a textfield in it that the XML quote gets loaded into.

here’s what I’ve got on the main timeline:

```auto
function loadXML (loaded) {
	if (loaded) {
		xmlRoot = this.firstChild;
		saying = [];
		total = xmlRoot.childNodes.length;
		for (i=0; i<total; i++) {
			saying* = xmlRoot.childNodes*.firstChild.nodeValue;
		}
	}
}

xmlData = new XML ();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("sayings.xml");

_root.createEmptyMovieClip("emptymc", 100);
	
bobbles.ryan.ryanHead.onRelease = function() {
	_root.attachMovie("cbRyan", emptymc, 100, {_x:170, _y:100});
	p = Math.floor(Math.random() * total);
	_root.emptymc.cbRyan.chatryan.text = saying[p];
}

```

the mc loaded into the empty mc is called cbRyan and the textfield is called chatryan.

Any ideas as to why the XML won’t load into the textfield?
