日期:2013-12-17  浏览次数:20588 次

点击这里下载源文件


picx_array = new Array(); //图片元件的X坐标
picy_array = new Array(); //图片元件的Y坐标
xx_array = new Array(30, 135, 30, 135, 30, 135); //图片被放入答案框的位置 X坐标
yy_array = new Array(110, 110, 170, 170, 230, 230); // 图片被放入答案框的位置 Y坐标
ansxx_array=new Array(30,265,370,265,135,30); //显示答案时的图片位置x坐标
ansyy_array=new Array(110,110,110,170,110,170);
m1_array = new Array(0, 0, 0, 0, 0, 0); //第一个答案框放入图片位置标志
m2_array = new Array(0, 0, 0, 0, 0, 0); //第二个答案框放入图片位置标志
answer_array = new Array(0, 0, 0, 0, 0, 0); //答案记录数组
key_array = new Array(1, 2, 2, 2, 1, 1); //正确答案,1表示图片在第一个答案框
pic_num = 6; //图片总数
answer._visible = false; //结果显示板隐藏
answer.swapDepths(30); //交换到深度30
for (var i = 1; i<pic_num+1; i++) {
picx_array[i-1] = eval("pic"+i)._x; //将图片的初始位置存入数组
picy_array[i-1] = eval("pic"+i)._y;
eval("pic"+i).swapDepths(i); //并置入深度
eval("pic"+i).pd1 = 0; //位置变量
eval("pic"+i).pd2 = 0;
}
for (var i = 1; i<pic_num+1; i++) {
eval("pic"+i).onPress = function() {//图片接收鼠标按下信息
this.startDrag(); //将图片拖动
this.swapDepths(20); //深度置为20
this._alpha = 65; //通明度为65
m1_array[this.pd1-1] = 0;
m2_array[this.pd2-1] = 0;
};
eval("pic"+i).onRelease = function() {
this.stopDrag(); //停止拖动
tmp = Number(this._name.slice(3, 4)); //提取图片元件中的数字
this.swapDepths(tmp); //交换为原来的深度
this._alpha = 100; //通明度为100
if (this.hitTest(m1_mc)) { //如果与答案框一接触
end = 0;
for (var m = 1; m<7; m++) {
if (end == 0) {
if (m1_array[m-1] == 0) {
this._x = xx_array[m-1];
this._y = yy_array[m-1];
m1_array[m-1] = 1;
answer_array[tmp-1] = 1;
trace(answer_array);
end = 1;
this.pd1 = m;
this.pd2 = 0;
pd3 = 0;
continue;
}
this._x = picx_array[tmp-1];
this._y = picy_array[tmp-1];
answer[tmp-1] = 0;
this.pd1 = 0;
this.pd2 = 0;
pd3 = 0;
}
}
} else if (this.hitTest(m2_mc)) {
end = 0;
for (var m = 1; m<7; m++) {
if (end == 0) {
if (m2_array[m-1] == 0) {
this._x = xx_array[m-1]+240;
this._y = yy_array[m-1];
m2_array[m-1] = 1;
answer_array[tmp-1] = 2;
trace(answer_array);
end = 1;
this.pd1 = 0;
this.pd2 = m;
pd3 = 0;
continue;
}
this._x = picx_array[tmp-1];
this._y = picy_array[tmp-1];
answer[tmp-1] = 0;
this.pd1 = 0;
this.pd2 = 0;
pd3 = 0;
}
}
} else {
this._x = picx_array[tmp-1];
this._y = picy_array[tmp-1];
this.pd1 = 0;
this.pd2 = 0;
pd3 = 0;
}
};
}
answer_show.onRelease = functio