Help with platform game

Hey, I am in the process of making a platform game and I can’t seem to get the wall codes right. I have followed the tutorial that Nathan supplied on here but something isn’t right.
Here is the code:
if (dir == “right” && !_root.leftblock.hitTest(this._x+20, this._y, true)) { this._x += speed; _root._x -= speed;} if (dir == “left” && !_root.rightblock.hitTest(this._x-20, this._y, true)) { this._x += speed; _root._x -= speed;} Maybe it is just me and I am doing something wrong, but I would like some help… Also is there a way to loop the background or make it static so as you move off the screen to the next part of the level you will still see the same background?