Hey all, I’m having trouble getting each new movieclip to change it’s _.x position. I’m loading 7 images (img1.jpg - img7.jpg) It does attempt to load each image, because when I change currentImg to 0 I get an output error saying it could not load img0.jpg. My output also returns the Image Number as being 1 more than it actually is.
Each image just gets piled on the next one though so all I see is img7.jpg. The width of each image is 100px right now, but the final product will have each image as a random size between two numbers, so I can’t just make it scoot over 100px for each new image. All of this happens inside a listener called fullContainer.
Here is my code:
// Listener
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(this);
// Variables
var currentImg:Number = 1;
var imgTotal:Number = 7;
var xPos = 0;
var yPos = 0;
//When loaded do:
function onLoadInit(_mc:MovieClip) {
trace ("Image number " + currentImg + “.”);
trace ("Width is " + _mc._width + " and Height is " + _mc._height);
trace ("X position is " + _mc._x + " and Y position is " + _mc._y);
_mc._width = 100;
_mc._yscale = _mc._xscale;
_mc._x = xPos;
_mc._y = yPos;
trace ("Image number " + currentImg + “.”);
trace ("Width is " + _mc._width + " and Height is " + _mc._height);
trace ("X position is " + _mc._x + " and Y position is " + _mc._y);
}
//Move the new MC over, and load the next
function init() {
xPos += _mc._width;
loader.loadClip(“img” + currentImg + “.jpg” , fullContainer);
}
//Keep doing this until all images are on the stage
for(currentImg; currentImg <= imgTotal; currentImg++){
init();
}
Thanks a bunch!
~Jake