0
我正在從XML向後加載我的MC,並且每頁分隔10個。當它被裝載到舞臺上時,它不能相應地安排到網格上。當我在其他頁面點擊讓它以前加載XML對象之前再跑10,它不添加到陣列中(我已經償清前陣重新加載XML)安排從XML向後調用的MC
private function loadItem():void {
commentArray=new Array();
var columns:int=Math.ceil(stage.stageWidth/300);
var x_counter:Number=0;
var y_counter:Number=0;
var firstItem=myXMLList.length()-(currentPage*ItemPerPage);
var lastItem=firstItem-ItemPerPage;
if (lastItem<=0) {
lastItem=0;
}
//trace("firstItem="+firstItem, "lastItem="+lastItem)
for (i=(firstItem-1); i>lastItem; i--) {
cBox=new MovieClip();
//cbox created from here
items();
allcBox.addChild(cBox);
commentBox();
//moving object to top layers
cBox.setChildIndex(cBox.getChildByName("box"+i),0);
//arranging object in grids
for (l; l<ItemPerPage; l++) {
commentArray.push(cBox);
commentArray[l].x=(200+10)*x_counter;
commentArray[l].y=((60)*y_counter);
if (x_counter+1<columns) {
x_counter++;
} else {
x_counter=0;
y_counter++;
}
}
addChild(allcBox);
allcBox.y=-(allcBox.height+50);
}
}
//clearing off array to run a new set so could arrange item in grids
private function clearEverything():void {
commentArray.splice(0,commentArray.length);
currentPage=pagesArray.indexOf(event.target);
loadWishes();
}
我的猜測在問題可能是2循環哪一個正在使用++和另一個 - ?