Hi all… I like to create an xml image marquee. The codes I have below only allow me to scroll the images left and right upon mouseover. Can anyone show wat’s the script like to have the images auto scroll horizontally? Or rather can anyone show an example how to create an xml image marquee?
var gutter = 0;
var firstImg = 165;
var thumbW;
var holder_arr = new Array();
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
if (success) {
DisplayImg();
} else {
trace("XML Not Loaded");
}
};
my_xml.load("marquee-images.xml");
//
//xml function //////////////////////////////
function DisplayImg() {
start = my_xml.firstChild.childNodes;
for (i=0; i<start.length; i++) {
allxml = start*;
imagesNames = allxml.childNodes;
for (n=0; n<imagesNames.length; n++) {
holder_arr.push(imagesNames[n].childNodes);
}
thHolder_mc.thumb_mc.SequentialImages(this.holder_arr);
}
}
//
//Load thumbnail images in sequence
MovieClip.prototype.SequentialImages = function(images) {
this.curImage = 0;
this.images = images;
this.ImageFromSequence();
this.onEnterFrame = function() {
clipLoaded = this.imageClip.getBytesLoaded();
clipTotal = this.imageClip.getBytesTotal();
percent = clipLoaded/clipTotal;
if (percent == 1) {
this.imageClip.id = this;
this.imageClip.idx = this.curImage;
this.imageClip.onRollOver = function() {
this._alpha = 100;
};
this.imageClip.onRollOut = this.imageClip.DragOut=function () {
this._alpha = 100; // 40
};
this.curImage++;
if (this.curImage>=this.images.length) {
this.onEnterFrame = undefined;
thumbW = thumb_mc._width;
} else {
this.ImageFromSequence();
}
}
};
};
//
//
MovieClip.prototype.ImageFromSequence = function() {
this.imageClip = this.createEmptyMovieClip("thumb"+this.curImage+"_mc", this.curImage);
this.imageClip.loadMovie(this.images[this.curImage]+".jpg");
this.imageClip._alpha = 100; // 40
if (this.curImage != 0) {
this.imageClipPrev = this["thumb"+(this.curImage-1)+"_mc"];
this.imageClip._x = (this.imageClipPrev._x+this.imageClipPrev._width+gutter);
}
};
thHolder_mc.thumb_mc.setMask(thHolder_mc.mask_mc);
//
//
thHolder_mc.thumb_mc.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = thHolder_mc.stroke_mc.getBounds(_root);
function scrollPanel() {
if (_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
if (thHolder_mc.thumb_mc._x>=gutter) {
thHolder_mc.thumb_mc._x = gutter;
}
if (thHolder_mc.thumb_mc._x<=thHolder_mc.mask_mc._width-thHolder_mc.thumb_mc._width) {
thHolder_mc.thumb_mc._x = thHolder_mc.mask_mc._width-thHolder_mc.thumb_mc._width;
}
// Move thumbnails differing on cursor's distance from centre
var xdist = (_xmouse - b.xMin)-(thHolder_mc.stroke_mc._width/2);
thHolder_mc.thumb_mc._x += -xdist/20;
}