最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
光标放上去小图变大的图片横向轮转
时间:2022-07-02 17:13:57 编辑:袖梨 来源:一聚教程网
那弹性的还真难做,试了一个下午没做出来.............你看看这样行不:
//图片总数:
total = 7;
//间距:
d = 25;
//图片宽:
w = 100;
//总长:
W = total*(w+d);
//图片变大变小的速度:
dScale = 10;
//在场景中加入图片:
for (i=1; i<=total; i++) {
this.attachMovie("pic", "pic"+i, i, {_x:i*(w+d)-W/2});
pic = this["pic"+i];
pic.gotoAndStop(i);
//鼠标放在图片上:
pic.onRollOver = function() {
this.onEnterFrame = function() {
//变大:
this._xscale = this._yscale += dScale;
//以该图片为基准调整距离:
pic0 = this;
distance(pic0);
//如果大到一定程度就停止变大:
if (this._xscale>200) {
this._xscale = this._yscale=200;
delete this.onEnterFrame;
pic0 = head;
}
};
};
//鼠标离开图片:
pic.onRollOut = function() {
this.onEnterFrame = function() {
//变小:
this._xscale = this._yscale -= dScale;
//以该图片为基准调整距离:
pic0 = this;
distance(pic0);
//如果小到一定程度就停止变小:
if (this._xscale<100) {
this._xscale = this._yscale=100;
delete this.onEnterFrame;
pic0 = head;
}
};
};
//用来建个类似双向链表的东东:
pic.prevPic = prevPic;
prevPic.nextPic = pic;
prevPic = pic;
}
//形成环链:
this.pic1.prevPic = this["pic"+total];
this["pic"+total].nextPic = this.pic1;
//
head = this.pic1;
tail = this["pic"+total];
//以链头为基准(用来调整距离):
pic0 = head;
//
function onEnterFrame() {
if (head._x<-W/2) {
head._x = tail._x+(tail._width+head._width)/2+d;
tail = head;
head = head.nextPic;
pic0 = head;
} else if (tail._x>W/2) {
tail._x = head._x-(tail._width+head._width)/2-d;
head = tail;
tail = tail.prevPic;
pic0 = head;
}
head._x += -_xmouse/20;
distance(pic0);
}
//--------------------------------------------------------------------------------------------
//以pic0为基准调整各幅画间距离的函数:
function distance(pic0) {
var pic = pic0;
while (pic != head) {
pic.prevPic._x = pic._x-(pic._width+pic.prevPic._width)/2-d;
pic = pic.prevPic;
}
pic = pic0;
while (pic != tail) {
pic.nextPic._x = pic._x+(pic._width+pic.nextPic._width)/2+d;
pic = pic.nextPic;
}
}
相关文章
- 光遇10.10礼帽代币在哪里 光遇10月10日时装节代币收集攻略 10-11
- 无期迷途幻境尘影怎么玩 10-11
- 闪耀暖暖10.12有什么更新 10-11
- 决胜巅峰全英雄皮肤免费福利 10-11
- 归龙潮尘嚣怎么样 10-11
- 光遇10.11免费魔法有什么 10-11