PDA

View Full Version : Remove attached MovieClip



Mochachino
February 7th, 2007, 04:04 AM
Hi all

Could anyone help me to unload the attached movieClip when I use loadMovie to load a new clip?



//We loaded the XML
xmlTree = new XML();
xmlTree.ignoreWhite = true;
xmlTree.onLoad = function (success){
if (success){
tofillTree();
}
else{
trace("The XML could not be loaded");
}
}
xmlTree.load("animation.xml");


function tofillTree(){
//Attach masters to the component
attachMovie("Tree", "myTree", 1);

//Properties
myTree.move(10, 200);
myTree.setSize(210, 300);
myTree.setStyle("openEasing", mx.transitions.easing.Back.easeOut);

//We filled the menu
myTree.dataProvider = xmlTree;

//event objectss
myTree.addEventListener("change", listChanged);
}

listChanged = new Object();
listChanged.change = function(evt_obj) {
var node = evt_obj.target.selectedNode;

//If it is a folder…
if (myTree.getIsBranch(node)){
//If this is a branch, expand/collapse it.
if (myTree.getIsOpen(node)){
myTree.setIsOpen(node, false, true);
}
//We opened it if this closed
else{
myTree.setIsOpen(node, true, true);
}
}
//If it is a bond…
else{
holder.loadMovie(node.attributes.myURL,1);
}
}


My problem is that when a new movie loaded into it using loadMovie, the attached movieClip still happened to be seen. How can we make it disappear?

Thanks a million.

Mocha