主题:  Movieclip Depth

s22

职务:版主
等级:4
金币:10.0
发贴:1634
#12003/6/6 16:59:38

After hearing a lot about managing movie clip depths, i think most people generally agree that it would be a good thing to have some way in AS of checking to see whether a specific depth is already in use by a movieclip. Hopefully the next version of Flash will support something like that. However, for now, i threw together a set of functions for allowing quick manipulations of movie clip depths. It's not really fool-proof (ie. currently, it only really manages depths in one location in a Flash movie), but I'm also working on a "depth manager class" that will handle this more robustly. Anyway...


if (_global.minDepth == undefined) {
_global.minDepth = 0;
}
if (_global.maxDepth == undefined) {
_global.maxDepth = 0;
}

MovieClip.prototype.addToStack = function(symbol,inst,initObj) {
var clip = (initObj == undefined)?
this.attachMovie(symbol,inst,maxDepth):
this.attachMovie(symbol,inst,maxDepth,initObj);
maxDepth++;
return clip;
}

MovieClip.prototype.removeFromStack = function() {
this.moveToFront();
maxDepth--;
this.removeMovieClip();
}

MovieClip.prototype.moveToFront = function() {
var curDepth = this.getDepth();
for (var i=curDepth;i<=maxDepth;i++) {
this.swapDepths(i);
}
}

MovieClip.prototype.moveToBack = function() {
var curDepth = this.getDepth();
for (var i=curDepth;i>=minDepth;i--) {
this.swapDepths(i);
}
}

MovieClip.prototype.moveForward = function() {
this.swapDepths(this.getDepth()+1);
}

MovieClip.prototype.moveBackward = function() {
this.swapDepths(this.getDepth()-1);
}



magicwind

职务:普通成员
等级:1
金币:1.0
发贴:160
#22003/6/12 9:27:23
good!从哪里转的? :)



realbobo

职务:普通成员
等级:1
金币:1.0
发贴:180
#32003/6/12 16:57:04
英文~~~晕,能讲讲功能吗?



s22

职务:版主
等级:4
金币:10.0
发贴:1634
#42003/6/13 12:31:29
^_^

離開FLASH版前,自己來暸個置頂。轉暸好幾,忘暸哪裏啦。



瀚叔

职务:普通成员
等级:1
金币:1.0
发贴:256
#52003/6/24 10:11:48
?楼上的版主是来自香港/台湾?用繁体!!



雅痞公子

职务:普通成员
等级:3
金币:-3.0
发贴:732
#62003/6/24 21:10:40
繁体,英文,我最不喜欢的



御林军

职务:普通成员
等级:1
金币:0.0
发贴:42
#72003/6/26 14:32:08
啥意思?



guking

职务:普通成员
等级:1
金币:1.0
发贴:202
#82003/6/27 17:15:55
拽文!!!



s22

职务:版主
等级:4
金币:10.0
发贴:1634
#92003/7/2 17:49:04
我乐意。



s22

职务:版主
等级:4
金币:10.0
发贴:1634
#102003/7/27 19:34:05

呵呵`见笑了

什么时候归队啊.