Hi there,
Im using zOrder - swapdepths array manipulation file.
Import movie clips into array. close movie button works fine. what i want to do is shift everything below closed button to eliminate the gap. I tried to reposition that with loop and use of ._y = but I am sure i messed it up. I pasted code below. Anyone have idea how to sort it out? Thanks
Goomy
CODE
// zOrder.fla by Nathan ****en - nathand@boxerjam.com (or) nk****en@aol.com
// to be used for educational purposes only :)
// this is a new version - sorry for the latest "buggy" one
// ..........................................................
// create new array for monitoring z-order
zOrderList = new Array("0");
defaultX = 100;
defaultY = 100;
increment = 25;
id = 0
// create a new windowObj...
function windowObj (title, content) {
// get the current depth based on the array
id++
var depth = id;
trace("id: "+id);
// create
_root.attachMovie("window", "window"+id, id);
this.window = _root["window"+id];
// position
this.window._y = defaultY+((id-1)*increment);
// set data
this.window.title = title;
this.window.content = content;
this.window.myID = id;
this.window.myDepth = zOrderList.length;
zOrderList.push(id);
}
// delete windowObj and splice zOrderList...
function closeWindow (incomingDepth) {
_root["window" + zOrderList[incomingDepth]].removeMovieClip();
zOrderList.splice(incomingDepth, 1);
for (i=incomingDepth; i<zOrderList.length; i++) {
// change each windowObj's depth
_root["window"+zOrderList[i]].myDepth--;
}
}
I uploaded FLA file as well here: http://goomys.com/kirupa/arraytest_kirupa.fla
Any help appreciated
I only know AS3, but as your looping, and the iteration is greater than the index removed, shift 25pixels and then call the addChild method again on the object. you dont need to remove first since addChild will just remove and insert into spot on stage w/ new cords.