Hi
I’m using XML for a dynamic continuous image scroller - I’m basically duplicating the images that come in from an XML file into two identical movieclips in a horizontal line and scolls across - then when the container gets halfway across it jumps back to the beginning.
Problem is that the images seem to be loading in a different order within the two movieclips everytime. I think it must be a loading/timing/cache issue.
Can anyone help as the deadline is 25mins over!!!
var xmlPath:String = "logos.xml";
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load(xmlPath);
_global.lastpos = 0;
_global.lastpos2 = 0;
var imagenumber = 0;
var imagenumber2 = 0;
myGalleryXML.onLoad = function() {
_root.gallery_width = myGalleryXML.firstChild.attributes.width;
_root.gallery_height = myGalleryXML.firstChild.attributes.height;
_root.gallery_y = myGalleryXML.firstChild.attributes.y;
_root.spacing = myGalleryXML.firstChild.attributes.spacing;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = _root.myImages.length;
createContainer();
callImages();
masking();
//mover();
};
function createContainer() {
_root.myGallery_mc = _root.createEmptyMovieClip("myGallery_mc", _root.getNextHighestDepth());
_root.myGallery_mc._y = _root.gallery_y;
_root.myGallery_mc._x = 0;
}
function callImages() {
_root.myImages_mc = _root.myGallery_mc.createEmptyMovieClip("myImages_mc", _root.myGallery_mc.getNextHighestDepth());
_root.myImages_mc2 = _root.myGallery_mc.createEmptyMovieClip("myImages_mc2", _root.myGallery_mc.getNextHighestDepth());
//_root.myImages_mc2._y=200;
var myMCL:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
var myMCL2:MovieClipLoader = new MovieClipLoader();
var mclListener2:Object = new Object();
myMCL.addListener(mclListener);
myMCL2.addListener(mclListener2);
for (i=0; i<_root.myImagesTotal; i++) {
imageURL = _root.myImages*.attributes.url;
image_mc = _root.myImages_mc.createEmptyMovieClip(i, _root.myImages_mc.getNextHighestDepth());
myMCL.loadClip(imageURL,image_mc);
image_mc2 = _root.myImages_mc2.createEmptyMovieClip(i, _root.myImages_mc2.getNextHighestDepth());
myMCL2.loadClip(imageURL,image_mc2);
}
mclListener.onLoadInit = function(target_mc:MovieClip)
{
target_mc._x = lastpos;
lastpos = lastpos + (target_mc._width) + int(_root.spacing);
imagenumber++
if(imagenumber==_root.myImagesTotal){
//_root.myImages_mc._width=(_root.myImages_mc._width + int(_root.spacing));
}
};
mclListener2.onLoadInit = function(target_mc2:MovieClip)
{
target_mc2._x = lastpos2;
lastpos2 = lastpos2 + (target_mc2._width) + int(_root.spacing);
imagenumber2++
if(imagenumber2==_root.myImagesTotal){
_root.myImages_mc2._x=-(_root.myImages_mc2._width + int(_root.spacing));
//_root.myImages_mc2._x=-(_root.myImages_mc2._width);
}
};
}
function masking() {
_root.myMask_mc = _root.createEmptyMovieClip("myMask_mc", _root.getNextHighestDepth());
//_root.myMask_mc.beginFill(0x000000,100);
_root.myMask_mc.lineTo(_root.gallery_width,0);
_root.myMask_mc.lineTo(_root.gallery_width,_root.gallery_height+_root.gallery_y);
_root.myMask_mc.lineTo(0,_root.gallery_height+_root.gallery_y);
_root.myMask_mc.lineTo(0,0);
_root.myMask_mc.endFill();
//_root.setMask(_root.myMask_mc);
}
_root.onEnterFrame = function() {
_root.myGallery_mc._x=_root.myGallery_mc._x+2;
if(_root.myGallery_mc._x>(_root.myGallery_mc._width/2)){
_root.myGallery_mc._x=-(int(_root.spacing)/2);
}
}