I have a simple flash image gallery. The way it works, is it uses a movieClip called “picContain” that it loads an image into, alphas it up, waits a few seconds, then alpha down, and repeats the process.
The code loops through an array for the image sources. It loops through the same number of times as items in the array. The problem is, as time goes by (about 15 minutes or so), it takes longer and longer to load the image. I’m guessing this is because it doesn’t unload the last picture that was loaded into the containing movie clip. Here’s the part of my code that loads the image:
function imageLoaded(e:Event) {
imageLoader.width = 1013;
imageLoader.height = 760;
Bitmap(imageLoader.content).smoothing = true;
picContain.addChild(imageLoader);
alphUp(picContain); // my alpha up function
}
Thing is, even if I wanted to use picContain.removeChild(), I couldn’t because removeChild requires an instance name in the parentheses- and these clips don’t have em. Is removeChild the solution? If so, how can I get it to remove whatever is in the containing clip without specifying?
Thanks for your help.
Simple, get a reference of ImageLoader by using the picContain display object container’s getChildAt() method. You have to specify the index of the ImageLoader in your picContain display object container as getChildAt()’s only argument(for the following I assume its at 0):
or you can simply use the removeChildAt() method: