AS2 to AS3 translation

Hi all,

Im kinda new to AS3… and im having some trouble with the “Sliding Menu” (http://www.kirupa.com/developer/flash8/slidingMenu.htm) tutorial on this site…

I found that most of the problems occur due to its AS version (AS2)… so i tried updating it to AS3 syntax as much as possible… (the code is below):

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

var currentPosition:Number = contentHold.content1.x;
var startFlag:Boolean = false;
function menuSlide(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;
    }

    addEventListener(Event.ENTER_FRAME, enteringFrame);
    function onEnterFrame(e:Event):void
    {
        currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
        distanceMoved +=  currentSpeed;
        contentHold.DisplayObject.x +=  dir * currentSpeed;
        if (Math.abs(distanceMoved - distanceToMove) <= 1)
        {
            [COLOR=Red]contentHold.DisplayObject.x = maskMovie.DisplayObject.x - currentPosition + dir * distanceToMove;[/COLOR]
            currentPosition = input.DisplayObject.x;
            startFlag = false;
            removeEventListener(Event.ENTER_FRAME, enteringFrame);
        }

    }
}

}

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

but still the “maskMovie” doesnt work out. It says:

“Error 1120: Access of undefined property maskMovie” (i have highlighted the line in red)

Can someone please translate the code into AS3 syntax pleassse, this is urgent… your help is very much appreciated :smiley:

Thank you!