i have a problem deleting movieclips attached to a empty MC and pushed into an array in the empty mc.
im using splice method.it seems doesnt when deleting mc’s randomly.
here’s the code and fla attached.
function starter(){
selectedView = _root.attachMovie("McDesign_mc","designer",this.getNextHighestDepth());
}
starter()
function attachDesignElement():Void {
nameIndex = selectedView.elements.length //element array defined inside designer
clipHolder = selectedView.attachMovie("clipart","clipart"+nameIndex,selectedView.getNextHighestDepth())
clipHolder.onRelease = function(){
element = substring(this, 25, -1)
selectedView.elements[element].removeMovieClip()
selectedView.elements.splice(element,1)
trace(selectedView.elements)
}
selectedView["clipart"+nameIndex].test.text = nameIndex;
selectedView["clipart"+nameIndex]._x = selectedView["clipart"+nameIndex]._y = nameIndex*15+40;
selectedView.elements.push(clipHolder);
}
_btn.onRelease = function() {
attachDesignElement()
}
if you delete 3rd mc and try deleteing a greater one (ex 5) it doesnt work.
please help