# Memory issues with looping moveclip and Loader

**URL:** <https://forum.kirupa.com/t/memory-issues-with-looping-moveclip-and-loader/303115>\
**Category:** Uncategorized\
**Created:** [January 14, 2010, 8:21am UTC](https://forum.kirupa.com/t/memory-issues-with-looping-moveclip-and-loader/303115 "2010-01-14T08:21:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzymc](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jazzymc](https://forum.kirupa.com/u/jazzymc)\
**Post date:** [January 14, 2010, 8:21am UTC](https://forum.kirupa.com/t/memory-issues-with-looping-moveclip-and-loader/303115/1 "2010-01-14T08:21:06Z")

</div>

Hello.

im working on a banner which have all data included from external text file and styled with css. I’ve figured many ssues but tha last one makes me crazy.

the code of the banner you can see here:

> **[TypeError: Error #1009: Cannot access a property or method of a null object...](https://www.kirupa.com/forum/showthread.php?t=342048)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

the issue it that my main timeline have 2 frames and the file loops. In this case all works fine , but the on every loop the actionscript loads all the Loaders and data again and again and this cause increasing memory usage (about 1 MB per 2/3 loops) .  
To fix this I’ve put a stop(); in the first frame , which fixed the memory leak issue, but now the CSS doesn’t load at all - I don’t know why. Also I’ve released that the CSS not loads if the clip have only one frame.

Any ideas?

the cide for the cssloader is

```auto

//Load text from external file
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);

function onLoaded(e:Event):void 
{

     title_txt.htmlText = e.target.data.titleText1;
     body_mc.body_txt1_mc.body_txt1.htmlText = e.target.data.bodyText1;
     body_mc.body_txt2_mc.body_txt2.htmlText = e.target.data.bodyText2;
     price_txt.htmlText = e.target.data.priceText;
     footer_txt.htmlText = e.target.data.footerText;
     order_txt.htmlText = e.target.data.orderText;
     play_txt.htmlText = e.target.data.playText;
}

myTextLoader.load(new URLRequest("myText.txt"));

//Load CSS styles from external file

var cssReq:URLRequest = new URLRequest("style.css");
var cssLoader:URLLoader = new URLLoader();

function cssLoaded(event:Event):void
{
    var sheet:StyleSheet = new StyleSheet();
    sheet.parseCSS(cssLoader.data);
    title_txt.styleSheet = sheet;
    body_mc.body_txt1_mc.body_txt1.styleSheet = sheet;
    body_mc.body_txt2_mc.body_txt2.styleSheet = sheet;
    price_txt.styleSheet = sheet;
    footer_txt.styleSheet = sheet;
    order_txt.styleSheet = sheet;
    play_txt.styleSheet = sheet;
         
}

cssLoader.addEventListener(Event.COMPLETE, cssLoaded);
cssLoader.load(cssReq);

```
