# Problems with INFINITE MENU HEEELP

**URL:** https://forum.kirupa.com/t/problems-with-infinite-menu-heeelp/284245
**Category:** flash
**Created:** [March 17, 2009, 4:16am UTC](https://forum.kirupa.com/t/problems-with-infinite-menu-heeelp/284245 "2009-03-17T04:16:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![deathz](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@deathz](https://forum.kirupa.com/u/deathz)
#### Post date: [March 17, 2009, 4:16am UTC](https://forum.kirupa.com/t/problems-with-infinite-menu-heeelp/284245/1 "2009-03-17T04:16:23Z")

</div>

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](http://rapidshare.com/files/210151202/portfolio.zip.html)

Please HEEEELP!
