In the following code when my movie first starts I want all my movieClips to be 25 pixels appart from each other no matter what the width of the mc. In the function “thumbnails” I can’t seem to get my images to be seperated by 25 pixels on start up.
I also want to set the y position of each movie clip so each image is seperated in the y direction by varying amounts but not to excede maxY amount. I haven’t built that in yet.
I am just trying to get them seperated in the x position by the correct amount.
Any help appreciated.:}
cliparray = [];
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
//image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
//description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 2;
var tot = 0;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
// if mouse enters hit state change direction
if (_root._xmouse>=(hit_right._x-40)) {
for (var obj in cliparray) {
cliparray[obj]._x -= scroll_speed;
}
//clip image from front added back in the rear
if (cliparray[0]._x<-cliparray[0]._width) {
cliparray[0]._x = cliparray[cliparray.length-1]._x+cliparray[cliparray.length-1]._width+25;
var j = cliparray.splice(0, 1);
cliparray = cliparray.concat(j);
}
// if mouse enters hit state change direction
} else if (_root._xmouse<=(hit_left._x+40)) {
for (var obj in cliparray) {
cliparray[obj]._x += scroll_speed;
}
//clip image from front added back in the rear
if (cliparray[cliparray.length-1]._x>hit_right._x) {
cliparray[cliparray.length-1]._x = cliparray[0]._x-(cliparray[cliparray.length-1]._width+25);
var j = cliparray.splice(cliparray.length-1, 1);
cliparray = j.concat(cliparray);
}
}
}
};
function thumbnails_fn(k) {
var yy = thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
cliparray.push(yy);
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
//target_mc._x = 5+(target_mc._width+5)*k;
target_mc._x = 5+target_mc._x+target_mc._width+25;
//trace(target_mc._width)
//tot += target_mc._x;
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}