I have a image sequence, loaded inside a movieclipe through XML, that when i rollOver it the image grows.
What i want is to have these images scrolling continous, without any gap and without any mouse comand on the page, like: 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3...
The code i'm using makes it continous, but there's an anourmous gap between the end of the images and the beginning of it again.
Does anyone have any idea on how to clear the gap?
here's the code for the scrooling:
onClipEvent(enterFrame) {
if(this._x<Stage.width) {
this._x+=2;
}else{
this._x = 0-this._width;
}
}
here's the code for loading the images trhoug XML:
//Image Slider By John Bezanis for SWFspot
//Settings to play with
//the height of the images when not stretched
var maxheight = 80;
//the y position of the "floor" or where the images sit on
var floor = 350;
//The amount an image scales to as the mouse gets closer
var curvedistance = 160;
//The amount of gap in between each image
var sidegap = 5;
//The background color of the document. This is used for the reflection
var bgcolor = 0xFFFFFF;
/*no more settings to play with below here */
//Initialize the image count to 0
var imagecount = 0;
//if the get parameter "xmlfile" is not set, change the xml file to load the data to a default name
if (_root.xmlfile == undefined || _root.xmlfile == "") {
//default name for the xml feed
_root.xmlfile = "sliderfeed.xml";
}
var myXml:XML = new XML();
myXml.ignoreWhite = true;
//Load the xml file
myXml.load(_root.xmlfile);
//run when the xml file has loaded
myXml.onLoad = function() {
//parse the xml file and load in the images
loadImages();
};
//start loading in the images
function loadImages() {
//traverse through each pic of the xml file
for (imageIndex=0; imageIndex<myXml.childNode
s[0].child
Nodes.leng
th; imageIndex++) {
//create a new instance of imagebox to load our pic,caption,and url into
attachMovie("imagebox", "im" + imageIndex, this.getNextHighestDepth()
);
//load in the pic
eval("im" + imageIndex).pic = myXml.childNodes[0].childN
odes[image
Index].chi
ldNodes[0]
.childNode
s[0].nodeV
alue;
//load the caption
eval("im" + imageIndex).caption = myXml.childNodes[0].childN
odes[image
Index].chi
ldNodes[1]
.childNode
s[0].nodeV
alue;
//load the url
eval("im" + imageIndex).url = myXml.childNodes[0].childN
odes[image
Index].chi
ldNodes[2]
.childNode
s[0].nodeV
alue;
//set the index to the current index of the for loop
eval("im" + imageIndex).index = imageIndex;
//move this above the caption box
eval("im" + imageIndex).swapDepths(cap
tionbox);
//increment the imagecount
imagecount++;
}
}
//run at the start of each frame
onEnterFrame = function () {
//only run if the image have been loaded
if (imagecount != 0) {
//figure out which image the mouse is closest to on the x plane
curmouseover = Math.max(0, Math.min(imagecount, imagecount*(_xmouse-sidega
p)/(Stage.
width-side
gap*2)));
//if the current x position is greater than our strip's width, create a movieclip as a placeholder
if (eval("im" + Math.floor(curmouseover)).
_x == undefined) {
this.createEmptyMovieClip(
"im" + Math.floor(curmouseover), this.getNextHighestDepth()
);
//Move the newly created clip to the width of the strip plus the sidegap
eval("im" + Math.floor(curmouseover)).
_x = Stage.width+sidegap;
}
//scale the image based on the image center's distance from x mouse position
scale = Math.max(100, curvedistance-(Math.abs((e
val("im" + Math.floor(curmouseover)).
_x+eval("i
m" + Math.floor(curmouseover)).
_width/2)-
_xmouse))/
4);
eval("im" + Math.floor(curmouseover)).
_xscale = scale;
eval("im" + Math.floor(curmouseover)).
_yscale = scale;
//Set the y position to the floor minus the height of the pic
eval("im" + Math.floor(curmouseover)).
_y = floor-eval("im" +Math.floor(curmouseover))
.image_mc.
_height*ev
al("im" + Math.floor(curmouseover)).
_yscale/10
0;
//traverse through the images to the right of the current selected image, scaling and setting the x position
for (curpos=Math.floor(curmous
eover); curpos<imagecount-1; curpos++) {
//scale the image based on the image center's distance from x mouse position
scale = Math.max(100, curvedistance-(Math.abs((e
val("im" + Math.floor(curpos))._x+eva
l("im" + Math.floor(curpos))._width
*1.5)-_xmo
use))/4);
eval("im" + Math.floor(curpos+1))._xsc
ale = scale;
eval("im" + Math.floor(curpos+1))._ysc
ale = scale;
//set the x position to the x position of the last image plus the width and sidegap
eval("im" + Math.floor(curpos+1))._x = eval("im" + Math.floor(curpos))._x+(ev
al("im" + Math.floor(curpos))._width
+sidegap);
//move the y position according to how much the image is scaled
eval("im" + Math.floor(curpos+1))._y = floor-eval("im" + Math.floor(curpos+1)).imag
e_mc._heig
ht*eval("i
m" + Math.floor(curpos+1))._ysc
ale/100;
}
//traverse through the images to the left of the current selected image, scaling and setting the x position
for (curpos=Math.floor(curmous
eover); curpos>0; curpos--) {
//scale the image based on the image center's distance from x mouse position
scale = Math.max(100, curvedistance-(Math.abs((e
val("im" + Math.floor(curpos-1))._x+e
val("im" + Math.floor(curpos-1))._wid
th/2)-_xmo
use))/4);
eval("im" + Math.floor(curpos-1))._xsc
ale = scale;
eval("im" + Math.floor(curpos-1))._ysc
ale = scale;
//set the x position to the x position of the last image minus the width and sidegap
eval("im" + Math.floor(curpos-1))._x = eval("im" + Math.floor(curpos))._x-(ev
al("im" + Math.floor(curpos-1))._wid
th+sidegap
);
//move the y position according to how much the image is scaled
eval("im" + Math.floor(curpos-1))._y = floor-eval("im" + Math.floor(curpos-1)).imag
e_mc._heig
ht*eval("i
m" + Math.floor(curpos-1))._ysc
ale/100;
}
}
};
Thanks a lot.
Start Free Trial