循环顺播倒播方法(爱好整理)

      AS 2007-7-15 10:53

//循环顺播方法
next_btn.onRelease = function() {
 var vfm:Number = 1+tu._currentframe%tu._totalframes;
 tu.gotoAndStop(vfm);
};


//循环倒播方法
prev_btn.onRelease = function() {
        var vfmC:Number = tu._currentframe;
        var vfmT:Number = tu._totalframes;
        tu.gotoAndStop((vfmC-1-1+vfmT)%vfmT+1);//吉人循环倒播精华
//特别的这里如果把vfmC-1-1中的后一个-1换成一个变量vx,即有vfmC-1+vx,则
//实现了当vx为正值1时为顺播,当vx为负值1时为倒播,当vx为正负除1外的数值时
//实现了跳播作用。请深入理解tu.gotoAndStop((vfmC-1+vx+vfmT)%vfmT+1);
};


//==================================================================
//循环倒播方法又一方法
function qian() {
 onEnterFrame = function () {
  if (this._currentframe == this._totalframes) {
   gotoAndPlay(1);
  } else {
   nextFrame();
  }
 };
}
function hou() {
 onEnterFrame = function () {
  if (this._currentframe == 1) {
   gotoAndPlay(this._totalframes);
  } else {
   prevFrame();
  }
 };
}

 源文件下载

var vx:Number;
function zhuan() {
 onEnterFrame = function () {
  var zh = _mc._totalframes;
  var dz = _mc._currentframe;
  _mc.gotoAndStop((dz-1+vx+zh)%zh+1);
 };
}
shun_btn.onRelease = function() {
 vx = 1;
 zhuan();
};
ni_btn.onRelease = function() {
 vx = -1;
 zhuan();
};
m_mc.onRelease = function() {
 //_root._mc.stop();//这句可以不要
 delete onEnterFrame;
};

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}