请翻译一个flash语言

来源:百度知道 编辑:UC知道 时间:2024/05/09 09:32:48
numOfMenu = 5;
maxOfWidth = 150;
minOfWidth = 30;
defaultOfWidth = 35;
endOfMenu = 780;
for (i=1; i<=numOfMenu; i++) {
this[i].mainText.gotoAndStop(i);
this[i].bg.useHandCursor = 0;
this[i].bg.onRollOver = function() {
_global.over = this._parent._name;
};
this[i].bg.onRollOut = this[i].bg.onDragOut=function () {
_global.over = 0;
};
this[i].onEnterFrame = function() {
if (over == this._name) {
this.nextFrame();
} else {
this.prevFrame();
}
if (over) {
if (this._name<=over) {
this.targetX = (endOfMenu-maxOfWidth-minOfWidth*(numOfMenu-1))+(this._name-1)*minOfWidth;
} else {
this.targetX =(endOfMenu-minOfWidth*(numOfMenu-1))+(this._name-2)*minOfWidth;
}
} else {
this.targetX = (endOfMenu-defaultOfWidth*numOfMenu)+(this._name-1)*defaultOfWidth;
}
this._x += (this.targetX-this._x)/4;
}

分给的太少了

numOfMenu = 5;
maxOfWidth = 150;
minOfWidth = 30;
defaultOfWidth = 35;
endOfMenu = 780;
循环给按钮加动作
for (i=1; i<=numOfMenu; i++) {
//显示相应针的文字
this[i].mainText.gotoAndStop(i);
//鼠标变成手
this[i].bg.useHandCursor = 0;
//当鼠标滑过赋值
this[i].bg.onRollOver = function() {
_global.over = this._parent._name;
};
//当鼠标滑出或者滑离赋值
this[i].bg.onRollOut = this[i].bg.onDragOut=function () {
_global.over = 0;
};

//当达到以下条件进行动作
this[i].onEnterFrame = function() {
if (over == this._name) {
//跳下一针
this.nextFrame();
} else {
//回上一针
this.prevFrame();
}
if (over) {
if (this._name<=over) {
//计算位置
this.targetX = (endOfMenu-maxOfWidth-minOfWidth*(numOfMenu-1))+(this._name-1)*minOfWidth;
} else {
//计算位置
this.targetX =(endOfMenu-minOfWidth*(numOfMenu-1))+(this._name-2)*minOfWidth;
}
} else