i have the following code:
// Iterate through result
for (i = 0; i <= numProjects-1; i++) {
// Variable Definitions
projectHolder = new MovieClip;
mcToPlace = "btn_project-" + type;
// Data definitions
var id:Number = projectData["id_" + i];
var title:String = projectData["title" + i];
var type:String = projectData["type" + i];
// trace
trace("the iteration is: " + i);
trace("the ID is: " + id + " and the title is: " + title + " and the type is: " + type);
trace("the data is: " + projectData);
// Place project holder
multiple = i/4;
if (multiple.toString().indexOf('.') == -1) {
projectHolderXPos = projectHolderX*185;
projectHolderYPos = 0;
projectHolderX++;
}
projectHolder = projectListHolder.attachMovie(mcToPlace, "btn_projectSelection_"+id, projectListHolder.getNextHighestDepth(), {_x:projectHolderXPos, _y:15+(projectHolderYPos*55)});
// Increment Y Pos and x
projectHolderYPos++;
// Set Latest project Information in text boxes
projectHolder.txt_projectTitle.text = title;
projectHolder.txt_projectCategory.text = type;
// Set Read More button
var thisButton = projectHolder;
thisButton.id = id;
thisButton.onPress = function() {
// Set global variable for news article to view
_global.projectid = this.id;
// Change page content
var lcontent:contentManager = new contentManager("change", "project_specific");
}
}
the traces in the code output the following:
number of projects is: 4
the iteration is: 0
the ID is: 1 and the title is: A Bahraini Tale and the type is: film
the data is: %09%0D%0A%0D%0A=&type3=film&title3=The%20Barrier&id%5F3=2&type2=film&title2=Four%20Girls&id%5F2=3&type1=film&title1=Visitor&id%5F1=4&type0=film&title0=A%20Bahraini%20Tale&id%5F0=1&numRows=4&onLoad=%5Btype%20Function%5D
the iteration is: 1
the ID is: 4 and the title is: Visitor and the type is: film
the data is: %09%0D%0A%0D%0A=&type3=film&title3=The%20Barrier&id%5F3=2&type2=film&title2=Four%20Girls&id%5F2=3&type1=film&title1=Visitor&id%5F1=4&type0=film&title0=A%20Bahraini%20Tale&id%5F0=1&numRows=4&onLoad=%5Btype%20Function%5D
the iteration is: 2
the ID is: 3 and the title is: Four Girls and the type is: film
the data is: %09%0D%0A%0D%0A=&type3=film&title3=The%20Barrier&id%5F3=2&type2=film&title2=Four%20Girls&id%5F2=3&type1=film&title1=Visitor&id%5F1=4&type0=film&title0=A%20Bahraini%20Tale&id%5F0=1&numRows=4&onLoad=%5Btype%20Function%5D
the iteration is: 3
the ID is: 2 and the title is: The Barrier and the type is: film
the data is: %09%0D%0A%0D%0A=&type3=film&title3=The%20Barrier&id%5F3=2&type2=film&title2=Four%20Girls&id%5F2=3&type1=film&title1=Visitor&id%5F1=4&type0=film&title0=A%20Bahraini%20Tale&id%5F0=1&numRows=4&onLoad=%5Btype%20Function%5D
yet, on the stage, only THREE of the movieclips are attached. no matter what i do, the FIRST ROW of the result just doesn’t show up on stage.
HOW CAN THE TRACE WORK YET THE SAME VARIABLES THREE LINES LATER NOT WORK… AND ONLY THE FIRST TIME?!
i just dont get it.