请详细解释这段flash代码

来源:百度知道 编辑:UC知道 时间:2024/07/04 03:30:21
// If not defined yet,
if (isLoaded == undefined) {

// Routine to move playhead to a new frame
var updateFrame = function (inc) {

var newFrame = _currentframe + inc;
gotoAndStop(newFrame);

if (_root._currentframe == 1) {
backBtn._alpha = 50;
backBtn.enabled = false;
} else {
backBtn._alpha = 100;
backBtn.enabled = true;
}
if (_root._currentframe == _root._totalframes) {
forwardBtn._alpha = 50;
forwardBtn.enabled = false;
} else {
forwardBtn._alpha = 100;
forwardBtn.enabled = true;
}
}

// When the forward button is pressed
forwardBtn.onPress = function () {
updateFrame(1);
}

// When the back button is pressed
backBtn.onPress = function () {
updateFrame(-1);
}

// When the keyboard keys are pressed
var keyListener = new Object();
keyListener

// If not defined yet,
//如果还没有定义
if (isLoaded == undefined) {

// Routine to move playhead to a new frame
// 构造函数
var updateFrame = function (inc) {
//赋值
var newFrame = _currentframe + inc;
//跳到NEWFRAME针
gotoAndStop(newFrame);
//如果当前针为1
if (_root._currentframe == 1) { ]
//BACK按钮透明度为50 不可以再按
backBtn._alpha = 50;
backBtn.enabled = false;
} else {
//BACK按钮透明度为100 可以再按
backBtn._alpha = 100;
backBtn.enabled = true;
}
//如果当前针等于总针数
if (_root._currentframe == _root._totalframes) {
//按钮透明度为50 不可以再按

forwardBtn._alpha = 50;
forwardBtn.enabled = false;
} else {

//按钮透明度为100 可以再按

forwardBtn._alpha = 100;
forwardBtn.enabled = true;
}
}

// When the forward button is pressed
//当forwardBtn被按 执行函数updateFrame(1);
forwardBtn.onPress = function () {
updateFrame(1);
}