Stick game

I have made a simple background, and a person that can walk, jump and duck and is suposed to climb when it hits a ladder. But it doesnt :frowning:

I have tried everything and still cant seem to find where I have gone wrong. I know that the way I have written the code isnt great, but I am still learning. I have made an array for the ladders and they work fine as I have tested them. Its just when I use the line if(Key.isDown(Key.UP)&&doing==false&&ladder==true){} thats the but that doesnt work.
If any one could have a look at the code and point me in the right direction it would be great.
cheers

var climbspeed = 2;
var doing = false;
var ladderarray = [];
this.onEnterFrame = function() {
 if (Key.isDown(Key.LEFT) && doing == false) {
  _root.char.gotoAndStop("walk");
  speed = -1;
  _root.char._xscale = -100;
  doing = true;
 } else {
  if (Key.isDown(Key.RIGHT) && doing == false) {
   _root.char.gotoAndStop("walk");
   _root.char._xscale = 100;
   speed = 1;
   doing = true;
  } else {
   if (Key.isDown(Key.UP) && doing == false && ladder == false) {
    _root.char.gotoAndStop("jump");
    doing = true;
   } else {
    if (Key.isDown(Key.DOWN) && doing == false) {
     _root.char.gotoAndStop("duck");
     doing = true;
    } else {
     if (Key.isDown(Key.UP) && doing == false && ladder == true) {
      _root.char.gotoAndStop("climb");
      _root.char._y -= climbspeed;
     }
    }
   }
  }
 }
 for (var i = 0; i<ladderarray.length; i++) {
  if (ladderarray*.hitTest(_root.char)) {
   ladder = true;
  } else {
   ladder = false;
  }
 }
};