# unloadMovie onEnterFrame problems!

**URL:** https://forum.kirupa.com/t/unloadmovie-onenterframe-problems/234743
**Category:** Uncategorized
**Created:** [August 5, 2007, 5:24pm UTC](https://forum.kirupa.com/t/unloadmovie-onenterframe-problems/234743 "2007-08-05T17:24:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stiffi](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@stiffi](https://forum.kirupa.com/u/stiffi)
#### Post date: [August 5, 2007, 5:24pm UTC](https://forum.kirupa.com/t/unloadmovie-onenterframe-problems/234743/1 "2007-08-05T17:24:44Z")

</div>

Hi

i am currently creating an application where i load different movies into a main application but instead of using the unloadMovie function on a button what i was hoping to do was have code saying to unloadMovie if not on current frame so the user wouldn’t have to unload the movie it would be done automatically

this is the code i am using:

```auto

this.createEmptyMovieClip("img_mc",2);
img_mc.loadMovie("game.swf");
    img_mc._lockroot = true;
    this.img_mc._x = 50;
    this.img_mc._y = 50;
    this.img_mc._xscale = 75; //Percent of original
    this.img_mc._yscale = 75; //Percent of original

img_mc.onEnterFrame = function(){
    
    if (_currentframe != 47) {
        img_mc.unloadMovie();
        delete this.onEnterFrame;
        trace ("deleted onEnterFrame");
    }
};
        

        

```

What is happening is that the game is displaying but not unloading any suggestions !!!
