Hello,
I have a basic drag and drop exercise that generates clips based on an XML file. The clips are then scambled and placed at the bottom of the canvas. Can you look below and see if there is an easy way to center the clips. The code checks if the clips in the row are longer than the bounding box, and if so, starts a new row. Any way to center each row?
function scrambleClips(){
for (j=0; j<total; j++){
randomPlacement = Math.floor(Math.random() * dragableClips.length + 0);
if (j == 0) {
dragableClips[randomPlacement]._x = 10;
dragableClips[randomPlacement]._y = lastItem+j30+55;
_global.z = lastItem+j30+55;
firstRowY = dragableClips[randomPlacement]._y;
firstRowX = dragableClips[randomPlacement]._x;
} else if (clipLength < 450){
dragableClips[randomPlacement]._x = newXLocation;
dragableClips[randomPlacement]._y = previousYLocation;
} else {rowNumber = rowNumber + 1;
if (rowNumber == 1){
dragableClips[randomPlacement]._x = 10;
dragableClips[randomPlacement]._y = firstRowY+dragableClips[randomPlacement]._height+10;
clipLength = 0;
} else if (rowNumber == 2){
dragableClips[randomPlacement]._x = 10;
dragableClips[randomPlacement]._y = firstRowY+(dragableClips[randomPlacement]._height2+20);
clipLength = 0;
} else if (rowNumber == 3){
dragableClips[randomPlacement]._x = 10;
dragableClips[randomPlacement]._y = firstRowY+(dragableClips[randomPlacement]._height3+30);
clipLength = 0;
}
}
newXLocation = dragableClips[randomPlacement]._x+dragableClips[randomPlacement]._width+10;
previousYLocation = dragableClips[randomPlacement]._y;
clipLength = dragableClips[randomPlacement]._x+dragableClips[randomPlacement]._width+clipLength;
dragableClips.splice(randomPlacement,1);
}
}