flash (macromedia):
I loaded a movieclip with the following code. How can I unload it when i move to a different frame? Do I have to loop through all the xml images again & use UnloadClip or is there a better way? StencilGalleryXML = new XML(); StencilGalleryXML.onLoad = init; StencilGalleryXML.load("stencils.xml"); StencilGalleryXML.ignoreWhite = true; var MCL = new MovieClipLoader(); function init(success) { if (success == true) { imgDesc = ""; rootNode = StencilGalleryXML.firstChild; nbrStencils = rootNode.childNodes.length; currentStencil = rootNode.firstChild; for (i=0; i<nbrStencils; i++) { mcName = "stencil"+i; loadImage(currentStencil.attributes.swfURL, mcName, currentStencil.firstChild.nodeValue, i+1); currentStencil = currentStencil.nextSibling; } } } function loadImage(imgSrc, clipName, desc, ctr) { this.createEmptyMovieClip("parent", this.getNextHighestDepth()); newClip = parent.createEmptyMovieClip(clipName, this.getNextHighestDepth()); newClip.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); MCL.loadClip(imgSrc, newClip.container_mc); }
Do you want to unload them to clear up ram, or to just get rid of the images? If it?s to clear up ram then yeah, you?ll have to get rid of each picture one by one. However If you just want to remove them from the screen, then you can just remove the movie clip they reside in. I?m not exactly sure what you?re trying to accomplish with this. May I see the effect? As you loop through each image in the xml file, you?re loading the images into a clip called "parent". Because you?re using the same name for each image, only the last image will show. The others will be deleted. Is this right?
Don't see what you're looking for? Try a search.
|