AS3 and XML

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!