tags:

views:

12

answers:

1

Hi all,

How to make the gallery looping.when last image in the gallery finished i want to show from the beginning.(horizontal auto scrolling the images from right to left).Please help! 

Here the code below for scrolling but i want to scroll continuously when last image over

addEventListener(Event.ENTER_FRAME, leftSideScrolling);

private function leftSideScrolling(e) {

 galleryWidth = rootClip.imageContainer.width;
 speed = -(0.02 * (980 - 620));

rootClip.imageContainer.x+=-2;

  if (rootClip.imageContainer.x>0)
{

  rootClip.imageContainer.x= (-galleryWidth/2);

}

if (rootClip.imageContainer.x<(-galleryWidth/2)) {

rootClip.imageContainer.x=0;

}

}

A: 

Instead of scrolling the container, scroll the images inside the container.Assuming you're scrolling from right to left, when an image x is inferior to its width , meaning that the image is out of view , add it to the end of the image container, which would be the total width of the container minus the width of the image you're moving. that should do it!

PatrickS