# Nested Button In MC Using Sliding Menu Tutorial

**URL:** https://forum.kirupa.com/t/nested-button-in-mc-using-sliding-menu-tutorial/241121
**Category:** flash
**Created:** [October 10, 2007, 7:52am UTC](https://forum.kirupa.com/t/nested-button-in-mc-using-sliding-menu-tutorial/241121 "2007-10-10T07:52:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![LearningFlash](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@LearningFlash](https://forum.kirupa.com/u/LearningFlash)
#### Post date: [October 10, 2007, 7:52am UTC](https://forum.kirupa.com/t/nested-button-in-mc-using-sliding-menu-tutorial/241121/1 "2007-10-10T07:52:17Z")

</div>

Hi, I’ve been working on the **Sliding** Menu Tutorial:  
[http://www.kirupa.com/developer/flash8/slidingMenu.htm](http://www.kirupa.com/developer/flash8/slidingMenu.htm)

I got everything working great.  
I’m trying to alter it a bit. As secondary navigation, I’ve nested a previous and next buttons inside the content1 MC.

I’ve tried using different AS to get the nested buttons to work so;

Inside the content1 MC  
On the actions layer, I’ve tried:

–  
testnext.onRelease = function() {  
this.\_parent.\_parent.menuSlide(contentHold.content2);

};

–

this.testnext.onRelease = function() {  
\_parent.\_parent.menuSlide(.content2);  
};

–  
On the actual button instance, I’ve tried:  
on (release) {  
\_parent.\_parent.menuSlide(contentHold.content2);  
}

The action script used in the main time line on frame 10 is:

stop();  
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;

}

};

}

};  
b1.onRelease = function() {

menuSlide(contentHold.content1);

};  
b2.onRelease = function() {

menuSlide(contentHold.content2);

};

Can someone tell me what I’m doing wrong?  
Thanks
