-
Loops..
Hi,
I'm trying to unload all movie clips from continuing to spawn and move if I change to a certain frame. I've stopped them from spawning with a simple boolean statement but I'm having trouble with the unloading of movie clips that were already spawned just before changing frame in the scene.
I can do it, with really awful coding like so:
Code:
_root.ArrowSpawn = 0;
UnloadMovie("leftarrows1");
UnloadMovie("leftarrows2");
UnloadMovie("leftarrows3");
UnloadMovie("leftarrows4");
UnloadMovie("leftarrows5");
UnloadMovie("leftarrows6");
UnloadMovie("leftarrows7");
UnloadMovie("leftarrows8");
UnloadMovie("leftarrows9");
UnloadMovie("leftarrows10");
UnloadMovie("uparrows1");
UnloadMovie("uparrows2");
UnloadMovie("uparrows3");
UnloadMovie("uparrows4");
UnloadMovie("uparrows5");
UnloadMovie("uparrows6");
UnloadMovie("uparrows7");
UnloadMovie("uparrows8");
UnloadMovie("uparrows9");
UnloadMovie("uparrows10");
Etc...
However obviously it would be better to do the same thing with a loop. I tried using a foo loop method and didnt manage to get it working. Can anyone help?
Thanks :mrt: I need foo pity.
-
Try this:
Code:
for(i=0;i<11;i++){
UnloadMovie("leftarrows"+i);
UnloadMovie("uparrows"+i);
}
Hope that helps!!
-
Thank-you good Sir.
Thats almost what I tried the first time, but I didnt write it quite like that, hence the problem :)
-
you should remove them using removeMovieClip() rather than using unLoadMovie
unLoadMovie just 'empties' them but they will still exist, hence taking up memory...