# How to optimize loaded XML

**URL:** <https://forum.kirupa.com/t/how-to-optimize-loaded-xml/304279>\
**Category:** flash\
**Created:** [February 4, 2010, 8:14pm UTC](https://forum.kirupa.com/t/how-to-optimize-loaded-xml/304279 "2010-02-04T20:14:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)\
**Post date:** [February 4, 2010, 8:14pm UTC](https://forum.kirupa.com/t/how-to-optimize-loaded-xml/304279/1 "2010-02-04T20:14:08Z")

</div>

When using to load XML file, I have used Event.COMPLETE, Event.Progress, IOEventListener. Since listeners take up memory ressources.

I was wondering if it’s a good way and habit to optimize after it has been completed locaded by removing them.

ex:

```auto

loader.addEventListener(Event.COMPLETE, handleLoaded);

private function handleLoaded(event:Event):void
{
   Do necessary parsing and stuffs...
   
   // Removing useless events
   removeEventListener(Event.COMPLETE, handleLoaded);
   removeEventListener(ProgressEvent.PROGRESS, handleProgress);
   removeEventListener(IOErrorEvent.IO_ERROR, handleIOError);
}

```
