11/24/2010

as2 物件左右擺動

//物件=mc
stop();
this.onEnterFrame = function() {
// pointred1 起始位置 , this._xmouse/20 左右擺動誤差
abc = 502-this._xmouse/5;
this.mc._x += (abc-this.mc._x)/5;

};

//------------另外一種寫法by阿吉
onEnterFrame = function () {
maxX = 700;//座標的最大值最小值
minX = 300;//座標的最大值最小值
newPosition = 1000-_xmouse;
if (newPosition>maxX) {
newPosition = maxX;
} else if (newPosition newPosition = minX;
}
mc._x += (newPosition-mc._x)/8;
};

No comments:

Post a Comment