# AS3 and XML

**URL:** <https://forum.kirupa.com/t/as3-and-xml/284410>\
**Category:** Uncategorized\
**Created:** [March 18, 2009, 11:14pm UTC](https://forum.kirupa.com/t/as3-and-xml/284410 "2009-03-18T23:14:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tizius](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@tizius](https://forum.kirupa.com/u/tizius)\
**Post date:** [March 18, 2009, 11:14pm UTC](https://forum.kirupa.com/t/as3-and-xml/284410/1 "2009-03-18T23:14:56Z")

</div>

Hi,

I’m new to AS3. I’m just trying to fugure out how it works.

I’m loading a random quote from an xml file. No problem with it.  
I want a button that refreshes the quote when pressed.

Here is my code:

* * *

var loader:URLLoader = new URLLoader();  
loader.addEventListener(Event.COMPLETE, showRandomQuote);  
loader.load(new URLRequest(“threats.xml”));

var xml:XML;

function showRandomQuote(e:Event):void {  
xml = new XML(e.target.data);  
var quote:XMLList = xml.threat.person;  
var allNum:int = quote.length();  
var runNum:int = Math.floor(Math.random()\*allNum);  
perName.text = xml.threat.person.text()[runNum];  
threatText.text = xml.threat.words.text()[runNum];  
}

Again.addEventListener(MouseEvent.CLICK, showRandomQuote);

* * *

I returns: Property data not found on flash.display.SimpleButton and there is no default value.

I’ve tried to convert the button “Again” to a movieclip but it doesn’t work.

Any suggestion?

Thanks!
