第一针代码
点击这里下载源文件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&l