Hi,
I’m trying to develop an infinite menu (horizontal scroller) for a Portfolio.
It works but not properly the way it should. After few loops the images get out of sync I don’t know why.
And if possible can you also help to add some easing to the movement?
What I did was, I add to instances of the menu one called menu and another called menu1.
Than add the following code to the timeline:
import flash.events.Event;
var xcenter:Number=500;
var speed:Number=1/10;
menu.addEventListener(Event.ENTER_FRAME, doit);
menu1.addEventListener(Event.ENTER_FRAME, doit);
function doit(event:Event):void
{
var distance:Number=mouseX-xcenter;
event.target.x+=int(distance*speed);
if (event.target.x > 1100 && mouseX > 500) {
event.target.x = -1200;
}
if (event.target.x < -1020 && mouseX < 500) {
event.target.x = 1280;
}
}
The link to the FLA file is:
http://rapidshare.com/files/210151202/portfolio.zip.html
Please HEEEELP!