I’ve this function which generates some emptymovieclips and then adds a picture to them. Now I want to remove all the pictures generated bij one call of the function. What is the best way to do this. I was thinking of adding a listener to every generated movieclip to listen to a call from a specific function and then to remove itself. But I’m not sure how to inplement that, or if its possible.
function showPictures(amount:Number, size:Number, ring:Number):Void
{
for(i = 0; i < amount; i++)
{
tmp = _root.holder.createEmptyMovieClip(j+"n", j);
tmp2 = tmp.createEmptyMovieClip(j+"clipholder", j);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip)
{
target_mc._width = size;
target_mc._height = size;
target_mc.filters = [dropShadow];
}
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("pictures/"+j+".jpg", tmp2);
trace("pictures/"+j+".jpg");
j++;
if(ring == 2)
{
tmp._x = klein*[0];
tmp._y = klein*[1];
}
if(ring == 1)
{
tmp._x = middel*[0];
tmp._y = middel*[1];
}
if(ring == 0)
{
tmp._x = groot*[0];
tmp._y = groot*[1];
trace("hier");
}
}
}