# Dynamic unloadMovie

**URL:** <https://forum.kirupa.com/t/dynamic-unloadmovie/238172>\
**Category:** Uncategorized\
**Created:** [September 7, 2007, 8:52pm UTC](https://forum.kirupa.com/t/dynamic-unloadmovie/238172 "2007-09-07T20:52:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsd](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@tsd](https://forum.kirupa.com/u/tsd)\
**Post date:** [September 7, 2007, 8:52pm UTC](https://forum.kirupa.com/t/dynamic-unloadmovie/238172/1 "2007-09-07T20:52:46Z")

</div>

Hello, I need some help here to unload some duplicated movieclips.  
Sometimes the script is not unload all the movie clips.

And on frame 2, how to say by scripting “not go to next frame if all the movieclips is not unload”?

Well the script is:

frame1

```auto
fileToLoad = "flashText1.txt";
if (loadedVar=="yes") {
nextFrame();
} else {
gotoAndPlay(1);
}
mh_entries_X1._visible = false;

```

frame2

```auto
if (entriesCount > 0) {
    for (var i = 0; i < entriesCount; ++i) {
    unloadMovie("mh_entries_" + i);
    }
}

```

frame3

```auto
if (fileToLoad <> ""){
    ran = math.round(math.random()*1000+1);
    this.loadVariables(fileToLoad+"?"+ran,0);
}

```

frame4

```auto
//empty

```

frame5

```auto
if (entriesCount > 0) {
    myArray1=variable1.split("|");
    myArray2=variable2.split("|");
    myArray3=variable3.split("|");
    var startY = 17;
    if (entriesCount > 0) {
        for (var i = 0; i < entriesCount; ++i) {
            var name = "mh_entries_" + i;
            this.mh_entries_X1.duplicateMovieClip(name, i);
            this[name]._x = -236;
            this[name]._y = startY + ((i-1) * startY) + startY;
            this[name].title = myArray1*;
            this[name].description = myArray2*;
            this[name].urlTXT.text = myArray3*;
        }
    }
    mh_entries_X1._visible = false;
}

```

frame6

```auto
stop();

```

button 1

```auto
on (release) {
    if (_root.pages.scroll.scrolledMC.entriesCount > 0) {
        for (var i = 0; i < _root.pages.scroll.scrolledMC.entriesCount; ++i) {
        unloadMovie("_root.pages.scroll.scrolledMC.mh_entries_" + i);
        }
    }
    _root.pages.scroll.scrolledMC.fileToLoad = "flashText1.txt";
    _root.pages.scroll.scrolledMC.gotoAndPlay(2);
}

```

button 2

```auto
on (release) {
    if (_root.pages.scroll.scrolledMC.entriesCount > 0) {
        for (var i = 0; i < _root.pages.scroll.scrolledMC.entriesCount; ++i) {
        unloadMovie("_root.pages.scroll.scrolledMC.mh_entries_" + i);
        }
    }
    _root.pages.scroll.scrolledMC.fileToLoad = "flashText2.txt";
    _root.pages.scroll.scrolledMC.gotoAndPlay(2);
}

```

Thanks
