webstudio Forums

webstudio Forums (http://www.webstudio.com.cn/forum/index.php)
-   Flash actionscript (As1,As2) (http://www.webstudio.com.cn/forum/forumdisplay.php?f=6)
-   -   在网上下载了一个源码,有几个不懂的地方,请教高人 (http://www.webstudio.com.cn/forum/showthread.php?t=3538)

monong 2012-12-10 07:18 PM

在网上下载了一个源码,有几个不懂的地方,请教高人
 
var slideNum = 7;

var frameTimer = 200;

var speed = 0.3;

var imgWidth = this.slideImg._width/slideNum;
/////////////////////////////
//
///////////////////////////////////////////////////////////////////////
//
var slideOver = 0;
function slideMove() {
this.slideImg._x += speed*((targetx-1)-this.slideImg._x);
}
function slideSystem() {
for (var i = 1; i<=slideNum; i++) {
if (slideOver == i) {
if (this["slideMc"+i]._currentframe < this["slideMc"+i]._totalframes) {
this["slideMc"+i].nextFrame();
targetx = -imgWidth*(i-1);
}
} else {
if (this["slideMc"+i]._currentframe>1) {
this["slideMc"+i].prevFrame();
}
}
}
}
MovieClip.prototype.imgRollOver = function() {
mouseOver = true;
};
MovieClip.prototype.imgRollOut = function() {
mouseOver = false;
};
MovieClip.prototype.btnRollOver = function() {
slideOver = this._name.slice(7);
mouseOver = true;
};
MovieClip.prototype.btnRollOut = function() {
mouseOver = false;
};
mouseOver = false;
this.onEnterFrame = function() {
slideMove();
slideSystem();
if (mouseOver == false) {
if (timer++%frameTimer == 0) {
if (slideOver == slideNum) {
slideOver = 0;
}
slideOver++;
}
}
};
问题:1、targetx = -imgWidth*(i-1); 为什么是 -imgWidt
2、MovieClip.prototype.imgRollOver = function() {
mouseOver = true;
};
MovieClip.prototype.imgRollOut = function() {
mouseOver = false;
};
MovieClip.prototype.btnRollOver = function() {
slideOver = this._name.slice(7);
mouseOver = true;
};
MovieClip.prototype.btnRollOut = function() {
mouseOver = false;
};这几句的“=”前面的内容是什么意思呢?
3、if (timer++%frameTimer == 0) 是什么意思呢?timer是从哪来的。
先谢谢了!!!


所有时间均为格林尼治时间 +9。现在的时间是 07:25 AM

Powered by vBulletin® 版本 3.8.3
版权所有 ©2000 - 2018,Jelsoft Enterprises Ltd.
增强包 [3.4] 制作: PHP源动力   官方中文站: vBulletin 中文
copyright by webstudio.com.cn. All Rights Reserved.