# Can someone review my Code, please?

**URL:** https://forum.kirupa.com/t/can-someone-review-my-code-please/254098
**Category:** flash
**Created:** [March 7, 2008, 11:53pm UTC](https://forum.kirupa.com/t/can-someone-review-my-code-please/254098 "2008-03-07T23:53:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![schammy79](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@schammy79](https://forum.kirupa.com/u/schammy79)
#### Post date: [March 7, 2008, 11:53pm UTC](https://forum.kirupa.com/t/can-someone-review-my-code-please/254098/1 "2008-03-07T23:53:56Z")

</div>

I am trying to adapt the code from a Kirupa Tutorial to make a Sliding Menu ([kirupa.com - Sliding Menu](http://www.kirupa.com/developer/flash8/slidingMenu.htm))…

With the code below, I don’t get any error message, but the slide just does not move. Doesn’t twitch. LOL :huh:

Maybe someone can help me figure it out? Also I believe this should help other people as I saw there had been some previous requests for a converted code for that tutorial.

Thanks a zillion!!! :azn:

> 

[COLOR=#0066ff]var currentPosition:Number = contentHold.content1.x;[/COLOR]  
[COLOR=#0066ff]var startFlag:Boolean = false;[/COLOR]  
[COLOR=#0066ff]menuSlide = function (input:MovieClip) {[/COLOR]  
[COLOR=#0066ff]if (startFlag == false) {[/COLOR]  
[COLOR=#0066ff]this.addEventListener(Event.ENTER\_FRAME,onEF);[/COLOR]  
[COLOR=#0066ff]startFlag = true;[/COLOR]  
[COLOR=#0066ff]var finalDestination:Number = input.x;[/COLOR]  
[COLOR=#0066ff]var distanceMoved:Number = 0;[/COLOR]  
[COLOR=#0066ff]var distanceToMove:Number = Math.abs(finalDestination-currentPosition);[/COLOR]  
[COLOR=#0066ff]var finalSpeed:Number = .3;[/COLOR]  
[COLOR=#0066ff]var currentSpeed:Number = 0;[/COLOR]  
[COLOR=#0066ff]var dir:Number = 1;[/COLOR]  
[COLOR=#0066ff]if (currentPosition\<=finalDestination) {[/COLOR]  
[COLOR=#0066ff]dir = -1;[/COLOR]  
[COLOR=#0066ff]} else if (currentPosition\>finalDestination) {[/COLOR]  
[COLOR=#0066ff]dir = 1;[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]function onEF(e:Event):void {[/COLOR]  
[COLOR=#0066ff]currentSpeed=Math.round(distanceToMove - distanceMoved + 1 \* finalSpeed);[/COLOR]  
[COLOR=#0066ff]distanceMoved+= currentSpeed;[/COLOR]  
[COLOR=#0066ff]contentHold.x+= dir \* currentSpeed;[/COLOR]  
[COLOR=#0066ff]if (Math.abs(distanceMoved - distanceToMove) \<= 1) {[/COLOR]  
[COLOR=#0066ff]contentHold.x=maskMovie.x - currentPosition + dir \* distanceToMove;[/COLOR]  
[COLOR=#0066ff]currentPosition=input.x;[/COLOR]  
[COLOR=#0066ff]startFlag=false;[/COLOR]  
[COLOR=#0066ff]this.removeEventListener(Event.ENTER\_FRAME,onEF);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]};[/COLOR]  
[COLOR=#0066ff]//-------------------------BUTTONS---------------------------------------------[/COLOR]  
[COLOR=#0066ff]b1.addEventListener(MouseEvent.CLICK, goslide2);[/COLOR]  
[COLOR=#0066ff]function goslide2(event:MouseEvent) {[/COLOR]  
[COLOR=#0066ff]menuSlide(contentHold.content1);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]b2.addEventListener(MouseEvent.CLICK, goslide3);[/COLOR]  
[COLOR=#0066ff]function goslide3(event:MouseEvent) {[/COLOR]  
[COLOR=#0066ff]menuSlide(contentHold.content2);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]b3.addEventListener(MouseEvent.CLICK, goslide4);[/COLOR]  
[COLOR=#0066ff]function goslide4(event:MouseEvent) {[/COLOR]  
[COLOR=#0066ff]menuSlide(contentHold.content3);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]b4.addEventListener(MouseEvent.CLICK, goslide5);[/COLOR]  
[COLOR=#0066ff]function goslide5(event:MouseEvent) {[/COLOR]  
[COLOR=#0066ff]menuSlide(contentHold.content4);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]  
[COLOR=#0066ff]b5.addEventListener(MouseEvent.CLICK, goslide6);[/COLOR]  
[COLOR=#0066ff]function goslide6(event:MouseEvent) {[/COLOR]  
[COLOR=#0066ff]menuSlide(contentHold.content5);[/COLOR]  
[COLOR=#0066ff]}[/COLOR]
