HI all, I’m making this card and have the movie to remember the card _x _y the scale etc. But I have problem with the depth.
I can assign the movie to remember the depth of every movieclip, but I have problem reassign them, is this part of the script, I wonder anyone can tell me where I go wrong…
I want the selected images to appear at the same depth level in the preview as they are dragged on stage or manipulated by the user?So, for instance, I drag a pig, then a boy on the stage, then select the pig to be on top, preview needs to display them at the same depth.
Allow me to attach other file
www.dreamance.com/download/depthMXB.zip
Let me explain some of the core code
- The Invis button at the bottom. This first assign a depth to the movie you duplicated:
on (release, releaseOutside) {
stopDrag();
varHolder.itemData.push(singleData);
//
// swap depth
this["item"+varHolder.itemCount].swapDepths(this.varHolder.itemCount-1);
//
// save current item name
this.varHolder.currentGraphic = myName;
}
- item.bound.(invisbleButton). When the movie is on the stage, the user click on the movie itself to swap depth:
on (press) {
// start drag
startDrag(_parent);
//
// swap depth
this._parent.swapDepths(this._parent._parent.varHolder.itemCount-1);
// this._parent.swapDepths(90);
//
//
// save current item name
this._parent._parent.varHolder.currentGraphic = this._parent._name;
//
}
- Preview Button. This is update all the movieclip position and depth etc:
on (release) {
//
_parent.varHolder.outData = "";
//
getNextHighestDepth();
for (i=0; i<_parent.varHolder.itemData.length; i++) {
_parent.varHolder.itemData*[0] = Math.round(_parent["item"+(i+1)]._x);
_parent.varHolder.itemData*[1] = Math.round(_parent["item"+(i+1)]._y);
_parent.varHolder.itemData*[2] = Math.round(_parent["item"+(i+1)].picture._xscale);
_parent.varHolder.itemData*[3] = Math.round(_parent["item"+(i+1)].picture._yscale);
_parent.varHolder.itemData*[4] = Math.round(_parent["item"+(i+1)]._rotation);
_parent.varHolder.itemData*[5] = _parent["item"+(i+1)].picture._currentframe;
_parent.varHolder.itemData*[6] = _parent["item"+(i+1)].getDepth();
_parent.varHolder.itemData*[7] = _parent["item"+(i+1)]._name;
//
// output into data
_parent.varHolder.outData += _parent.varHolder.itemData*.join("/")+"-";
}
//
//
_parent.gotoAndPlay("preview");
}
- Frame 45. This will echo back the data saved, and try to reposition the movieclip:
inData = varHolder.outData.split("-");
//trace(inData);
//
//
for (i=0; i<inData.length; i++) {
duplicateMovieClip(itemShow, "itemShow"+i, i);
inSingle = inData*.split("/");
//
this["item"+i].trace(inSingle);
with (this["itemShow"+i]) {
_x = inSingle[0];
_y = inSingle[1];
picture._xscale = inSingle[2];
picture._yscale = inSingle[3];
_rotation = inSingle[4];
picture.gotoAndStop(inSingle[5]);
swapDepths(inSingle[6]);
// _name;
}
}
//
//
//
stop();
Thanks in advance