all groups > flash actionscript > december 2005 >
You're in the

flash actionscript

group:

How do I unload this movie clip??


How do I unload this movie clip?? natg504
12/22/2005 9:55:44 PM
flash actionscript:
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);
}
Re: How do I unload this movie clip?? kglad
12/23/2005 5:27:20 AM
you could use:

for(obj in this.parent){
if(typeof(this.parent[obj])=="movieclip"){
this.parent[obj].unloadMovie();
}
}

or you could just use:

this.parent.unloadMovie()

if you have no further need for this.parent.
AddThis Social Bookmark Button