Hello, example of pyramidal depth management:
MovieClip.prototype.addProperty("topDepth", function () { var mc, mcd, d; for (mcd in this) { if ((mc=this[mcd])._name == mcd & mc instanceof MovieClip & mc._parent == this) { return (d=this[mcd].getDepth()+1)<1 ? 1 : d; } } return 1; }, null); // --------------------------------------------------- this.onReleaseHandler = function() { this.pyramiDepth(false); }; this.pyramiDepth = function(depth, direction) { if (depth === false) { depth = this._parent.topDepth-1; this.swapDepths(depth); this.next_mc.pyramiDepth(depth-2, 1); this.prev_mc.pyramiDepth(depth-3, -1); } else { this.swapDepths(depth); if (direction == 1) { this.next_mc.pyramiDepth(depth-2, 1); } else if (direction == -1) { this.prev_mc.pyramiDepth(depth-2, -1); } } }; this.createAnyMc = function(this_obj, name, depth, prev_mc) { var mc = this_obj.createEmptyMovieClip(name, depth); mc.prev_mc = prev_mc; prev_mc.next_mc = mc; mc._x = (prev_mc._x+30) || 20; mc.lineStyle(0, 0xFF0000, 100); mc.beginFill(0xCCCCCC, 100); mc.lineTo(40, 0); mc.lineTo(45, 20); mc.lineTo(40, 40); mc.lineTo(0, 40); mc.lineTo(-5, 20); mc.lineTo(0, 0); mc.endFill(); mc.onRelease = this.onReleaseHandler; mc.pyramiDepth = this.pyramiDepth; trace(mc.prev_mc); return mc; }; // var prev_mc = undefined; for (var i = 0; i<6; i++) { prev_mc = this.createAnyMc(this, "mc"+i, i, prev_mc); } -- Ivan Dembicki ____________________________________________________________________________ [EMAIL PROTECTED] | | http://www.design.ru _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com