# Kirupa Sliding Menu need Prev, Next Function

**URL:** <https://forum.kirupa.com/t/kirupa-sliding-menu-need-prev-next-function/316215>\
**Category:** flash\
**Created:** [November 16, 2010, 8:45am UTC](https://forum.kirupa.com/t/kirupa-sliding-menu-need-prev-next-function/316215 "2010-11-16T08:45:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafimmedia](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@rafimmedia](https://forum.kirupa.com/u/rafimmedia)\
**Post date:** [November 16, 2010, 8:45am UTC](https://forum.kirupa.com/t/kirupa-sliding-menu-need-prev-next-function/316215/1 "2010-11-16T08:45:18Z")

</div>

Hi i have done one Product banner with help of Kirupa sliding menu  
[http://www.kirupa.com/developer/flash8/slidingMenu.htm](http://www.kirupa.com/developer/flash8/slidingMenu.htm)  
but i use only 2 Buttons for Previous and next function. i have changed the code like this . But now i need to load the Product -3 with respective the timer functionality. When i click the Next Button the Product shoud be incremented, i Think i need to do some increment’s onRelease area

For example :  
[http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery2.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery2.htm)

**The Code below what i have done :**

///////////////////////////////////////////////////////////////////

var currentPosition:Number = contentHold.content1.\_x;  
var startFlag:Boolean = false;  
menuSlide = function (input:MovieClip) {  
if (startFlag == false) {  
startFlag = true;  
var finalDestination:Number = input.\_x;  
var distanceMoved:Number = 0;  
var distanceToMove:Number = Math.abs(finalDestination-currentPosition);  
var finalSpeed:Number = .3;  
var currentSpeed:Number = 0;  
var dir:Number = 1;  
if (currentPosition\<=finalDestination) {  
dir = -1;  
} else if (currentPosition\>finalDestination) {  
dir = 1;  
}  
this.onEnterFrame = function() {  
currentSpeed = Math.round((distanceToMove-distanceMoved+1)_finalSpeed);  
distanceMoved += currentSpeed;  
contentHold.\_x += dir_currentSpeed;  
if (Math.abs(distanceMoved-distanceToMove)\<=1) {  
contentHold.\_x = maskMovie.\_x-currentPosition+dir\*distanceToMove;  
currentPosition = input.\_x;  
startFlag = false;  
delete this.onEnterFrame;  
}  
};  
}  
};

/////////////////////////////////

var \_first:Boolean = true;  
function goOn():Void {  
if (\_first) {  
\_first = false;  
menuSlide(contentHold.content2);  
} else {  
\_first = true;  
menuSlide(contentHold.content1);  
}

}  
var myDelay:Number = setInterval(goOn, 10000);

////////////////////////////////////

b1.onRelease = function() {

```
menuSlide(contentHold.content1);

```

};  
b2.onRelease = function() {

```
menuSlide(contentHold.content2);

```

};
