选择题课件制作一例
类别: Flash教程
第一针代码
« Full Screen »
点击这里下载源文件
answer_array = new Array(-1, -1, -1, -1);
key1_array = new Array(-1, -1, -1, 1);
_root.total=0;
for (var i = 1; i<5; i++) {
eval("l"+i).key = -1;
eval("l"+i).onRelease = function() {
this.play();
num = Number(this._name.slice(1, 2));
this.key = -this.key;
answer_array[num-1] = this.key;
};
}
answer._visible = false;
answer.close_win._visible=false;
answer_show.onRelease = function() {
k = 0;
for (var i = 0; i<4; i++) {
if (answer_array[i] == key1_array[i]) {
k++;
}
}
trace(k);
if (k == 4) {
answer.right_num = "正确";
_root.total++;
} else {
answer.right_num = "错误";
}
answer._visible = true;
//----------------------
for(var i=1;i<5;i++){
eval("l"+i).enabled=false;
}
};
answer.head.onPress = function() {
answer.startDrag();
};
answer.head.onRelease = function() {
answer.stopDrag();
};
answer.close_win.onRelease = function() {
answer._visible = false;
};
answer.answer.onRelease = function() {
for (var i = 0; i<4; i++) {
if (key1_array[i] == 1) {
eval("l"+(i+1)).gotoAndStop(2);
answer_array[i] = 1;
} else {
eval("l"+(i+1)).gotoAndStop(1);
answer_array[i] = -1;
}
}
};
answer.nextt.onRelease = function() {
for (var i = 1; i<5; i++) {
eval("l"+i).gotoAndStop(1);
}
_root.nextFrame();
for(var i=1;i<5;i++){
eval("l"+i).enabled=true;
}
};
stop();
key1_array = new Array(-1, -1, -1, 1);
_root.total=0;
for (var i = 1; i<5; i++) {
eval("l"+i).key = -1;
eval("l"+i).onRelease = function() {
this.play();
num = Number(this._name.slice(1, 2));
this.key = -this.key;
answer_array[num-1] = this.key;
};
}
answer._visible = false;
answer.close_win._visible=false;
answer_show.onRelease = function() {
k = 0;
for (var i = 0; i<4; i++) {
if (answer_array[i] == key1_array[i]) {
k++;
}
}
trace(k);
if (k == 4) {
answer.right_num = "正确";
_root.total++;
} else {
answer.right_num = "错误";
}
answer._visible = true;
//----------------------
for(var i=1;i<5;i++){
eval("l"+i).enabled=false;
}
};
answer.head.onPress = function() {
answer.startDrag();
};
answer.head.onRelease = function() {
answer.stopDrag();
};
answer.close_win.onRelease = function() {
answer._visible = false;
};
answer.answer.onRelease = function() {
for (var i = 0; i<4; i++) {
if (key1_array[i] == 1) {
eval("l"+(i+1)).gotoAndStop(2);
answer_array[i] = 1;
} else {
eval("l"+(i+1)).gotoAndStop(1);
answer_array[i] = -1;
}
}
};
answer.nextt.onRelease = function() {
for (var i = 1; i<5; i++) {
eval("l"+i).gotoAndStop(1);
}
_root.nextFrame();
for(var i=1;i<5;i++){
eval("l"+i).enabled=true;
}
};
stop();
- 上一篇: FLASH ActionScript语言详解
- 下一篇: Flash打造文字跳动动画特效
-= 资 源 教 程 =-
文 章 搜 索