Need help with a simple function

Hey,

just wondering why this isn’t working :


var nav:Boolean = true;
var element:String = "home"; 
var vLogo:Boolean = false;
var speed:Number = 10;
var rightMenu:Number = 794;
var leftMenu:Number = 116;

function navigation() {
    if(nav == true) {
        for(var i:Number = _root.menu._x; i <= rightMenu; i + speed) {
        _root.menu._x = _root.menu._x + speed;
        }//end for
    }/*end if*/ else{
            for(var i:Number = _root.menu._x; i <= leftMenu; i + speed) {
        _root.menu._x = _root.menu._x - speed;
            }//end for
        }//end else
    }//end function

Its so that a menu will move right across the screen if the variable is true, and if its false, it’ll move left back to its original position… i achieved this using a motion tween and telling the mc to go to the frame and play, but that didn’t work in the end because if the menu bar was on the left side, and it was told to move to the left, then it would disappear, and appear on the other side… so in other words it screwed up :wink:

Thanks to any suggestions ! :smiley: