URLLoader repeating itself

Hi there,

I’m pretty new to Flash and AS3 but I’ve managed to figure most of my problems out with the help of books and the net…I’m having a problem with a URLLoader and I just cannot work it out.

The problem is that when I click on my buttons that start the function containing the URLLoader, the Loader loads the data repeatedly, as many times as I have clicked on a button. So, for example, if I click a button it will load the data twice. Click again and it loads it three times, again and it loads it four times etc…I know this because I traced the function that runs when the URLLoader is completed (xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded); )

This poses serious problems for me because each time this happens, the loader adds more and more children to the sprite I am loading the data (a simple XML List) and I cannot manipulate the objects correctly. On top of that I’m sure there is a memory problem.

Anyway, I’m sorry this is such a loaded question, but have you run into a problem like this before and do you have any suggestions? Thank you!