主题:  一个小问题

surfhere

职务:普通成员
等级:1
金币:1.0
发贴:195
#12002/6/3 17:20:51
有20个MC,我要选其中10个,让MC:gotoAndStop(3),程序如下:

array1 = new array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
for (i=0; i<10; i++) {
    array1.splice(random(array1.length), 1);
}
for (i=0; i<10; i++) {
    tempname = "treasure" add array1[i];
    -----tempname.gotoAndStop(3);-----
}

其中-----tempname.gotoAndStop(3);----这行有问题,但我不清楚怎样写,才能作用?
谢谢帮助



Demon.S

职务:版主
等级:5
金币:10.0
发贴:2468
#22002/6/3 18:46:10
if (array1[i] != null) tempname = "treasure" + array1[i];



janlay

职务:管理员
等级:7
金币:28.0
发贴:7244
#32002/6/3 21:27:10
this[tempname].gotoAndStop(3);



surfhere

职务:普通成员
等级:1
金币:1.0
发贴:195
#42002/6/4 9:10:55
成功了,谢谢JANLAY!