它就像金字塔一样,每个物体下面有2个物体,分为4层。
if (myXML.MEMBER[1].@AVAILABILITY=="NO") {
circlesArray[0][0].mouseEnabled=false;
TweenLite.to(circlesArray[0][0],0.8,{tint:0x333333});
manArray[0][0].mouseEnabled=false;
TweenLite.to(manArray[0][0],0,{tint:0x666666});
} else {
circlesArray[0][0].mouseEnabled=true;
manArray[0][0].mouseEnabled=true;
}
if (myXML.MEMBER[2].@AVAILABILITY=="NO") {
circlesArray[0][1].mouseEnabled=false;
TweenLite.to(circlesArray[0][1],0.8,{tint:0x333333});
manArray[0][1].mouseEnabled=false;
TweenLite.to(manArray[0][1],0,{tint:0x666666});
} else {
circlesArray[0][1].mouseEnabled=true;
manArray[0][1].mouseEnabled=true;
}
if (myXML.MEMBER[3].@AVAILABILITY=="NO") {
circlesArray[1][0].mouseEnabled=false;
TweenLite.to(circlesArray[1][0],0.8,{tint:0x333333});
manArray[1][0].mouseEnabled=false;
TweenLite.to(manArray[1][0],0,{tint:0x666666});
} else {
circlesArray[1][0].mouseEnabled=true;
manArray[1][0].mouseEnabled=true;
}
if (myXML.MEMBER[4].@AVAILABILITY=="NO") {
circlesArray[1][1].mouseEnabled=false;
TweenLite.to(circlesArray[1][1],0.8,{tint:0x333333});
manArray[1][1].mouseEnabled=false;
TweenLite.to(manArray[1][1],0,{tint:0x666666});
} else {
circlesArray[1][1].mouseEnabled=true;
manArray[1][1].mouseEnabled=true;
}
if (myXML.MEMBER[5].@AVAILABILITY=="NO") {
circlesArray[1][2].mouseEnabled=false;
TweenLite.to(circlesArray[1][2],0.8,{tint:0x333333});
manArray[1][2].mouseEnabled=false;
TweenLite.to(manArray[1][2],0,{tint:0x666666});
} else {
circlesArray[1][2].mouseEnabled=true;
manArray[1][2].mouseEnabled=true;
}
if (myXML.MEMBER[6].@AVAILABILITY=="NO") {
circlesArray[1][3].mouseEnabled=false;
TweenLite.to(circlesArray[1][3],0.8,{tint:0x333333});
manArray[1][3].mouseEnabled=false;
TweenLite.to(manArray[1][3],0,{tint:0x666666});
} else {
circlesArray[1][3].mouseEnabled=true;
manArray[1][3].mouseEnabled=true;
}
if (myXML.MEMBER[7].@AVAILABILITY=="NO") {
circlesArray[2][0].mouseEnabled=false;
TweenLite.to(circlesArray[2][0],0.8,{tint:0x333333});
manArray[2][0].mouseEnabled=false;
TweenLite.to(manArray[2][0],0,{tint:0x666666});
} else {
circlesArray[2][0].mouseEnabled=true;
manArray[2][0].mouseEnabled=true;
}
if (myXML.MEMBER[8].@AVAILABILITY=="NO") {
circlesArray[2][1].mouseEnabled=false;
TweenLite.to(circlesArray[2][1],0.8,{tint:0x333333});
manArray[2][1].mouseEnabled=false;
TweenLite.to(manArray[2][1],0,{tint:0x666666});
} else {
circlesArray[2][1].mouseEnabled=true;
manArray[2][1].mouseEnabled=true;
}
if (myXML.MEMBER[9].@AVAILABILITY=="NO") {
circlesArray[2][2].mouseEnabled=false;
TweenLite.to(circlesArray[2][2],0.8,{tint:0x333333});
manArray[2][2].mouseEnabled=false;
TweenLite.to(manArray[2][2],0,{tint:0x666666});
} else {
circlesArray[2][2].mouseEnabled=true;
manArray[2][2].mouseEnabled=true;
}
if (myXML.MEMBER[10].@AVAILABILITY=="NO") {
circlesArray[2][3].mouseEnabled=false;
TweenLite.to(circlesArray[2][3],0.8,{tint:0x333333});
manArray[2][3].mouseEnabled=false;
TweenLite.to(manArray[2][3],0,{tint:0x666666});
} else {
circlesArray[2][3].mouseEnabled=true;
manArray[2][3].mouseEnabled=true;
}
if (myXML.MEMBER[11].@AVAILABILITY=="NO") {
circlesArray[2][4].mouseEnabled=false;
TweenLite.to(circlesArray[2][4],0.8,{tint:0x333333});
manArray[2][4].mouseEnabled=false;
TweenLite.to(manArray[2][4],0,{tint:0x666666});
} else {
circlesArray[2][4].mouseEnabled=true;
manArray[2][4].mouseEnabled=true;
}
if (myXML.MEMBER[12].@AVAILABILITY=="NO") {
circlesArray[2][5].mouseEnabled=false;
TweenLite.to(circlesArray[2][5],0.8,{tint:0x333333});
manArray[2][5].mouseEnabled=false;
TweenLite.to(manArray[2][5],0,{tint:0x666666});
} else {
circlesArray[2][5].mouseEnabled=true;
manArray[2][5].mouseEnabled=true;
}
if (myXML.MEMBER[13].@AVAILABILITY=="NO") {
circlesArray[2][6].mouseEnabled=false;
TweenLite.to(circlesArray[2][6],0.8,{tint:0x333333});
manArray[2][6].mouseEnabled=false;
TweenLite.to(manArray[2][6],0,{tint:0x666666});
} else {
circlesArray[2][6].mouseEnabled=true;
manArray[2][6].mouseEnabled=true;
}
if (myXML.MEMBER[14].@AVAILABILITY=="NO") {
circlesArray[2][7].mouseEnabled=false;
TweenLite.to(circlesArray[2][7],0.8,{tint:0x333333});
manArray[2][7].mouseEnabled=false;
TweenLite.to(manArray[2][7],0,{tint:0x666666});
} else {
circlesArray[2][7].mouseEnabled=true;
manArray[2][7].mouseEnabled=true;
}
我已经尝试了 for ,但它无效
for (var i:uint=0; i<2; i++) {
for (var j:uint=0; j<2-1; j++) {
if (myXML.MEMBER[i].@AVAILABILITY=="NO") {
circlesArray[1][j].mouseEnabled=false;
TweenLite.to(circlesArray[1][j],0.8,{tint:0x333333});
} else {
circlesArray[1][j].mouseEnabled=true;
}
}
}
答案 0 :(得分:0)
好吧,首先,第一个循环应该迭代myXML.MEMBER.length(),你设置它的方式,不会覆盖你所有的成员。
以下可能是错误的,因为我无法测试它,因为您的方案不容易重新创建。但是,背后的逻辑应该易于纠正以使其工作。也许您应该检查一下您是否正在访问阵列中的有效项目以及类似的内容。
var t:int = myXML.MEMBER.length( );
var ii:int;
var jj:int;
for( var i:int = 0; i < t; i++ ) {
ii = circlesArray.length;
for ( var ci:int = 0; ci < ii; ci++ ) {
jj = circlesArray[ci].length;
for ( var cj:int = 0; cj < jj; cj++ ) {
if (myXML.MEMBER[i].@AVAILABILITY=="NO") {
circlesArray[ci][cj].mouseEnabled=false;
TweenLite.to(circlesArray[ci][cj],0.8,{tint:0x333333});
manArray[ci][cj].mouseEnabled=false;
TweenLite.to( manArray[ci][cj],0,{tint:0x666666});
} else {
circlesArray[ci][cj].mouseEnabled=true;
manArray[ci][cj].mouseEnabled=true;
}
}
}
}