Function problem


function createwall(x, y, vwidth, vheight, frame, doordir) {
for (var openwall = 0; openwall<=20; openwall++) {
if (this.wall_nbr[openwall] == 0) {
	_parent.attachMovie("wall", 'wall'+openwall, openwall+600);
	_parent['wall'+openwall]._x = wall_A[openwall].x=x;
	_parent['wall'+openwall]._y = wall_A[openwall].y=y;
	_parent['wall'+openwall]._width = wall_A[openwall].vwidth=vwidth;
	_parent['wall'+openwall]._height = wall_A[openwall].vheight=vheight;
	_parent['wall'+openwall].gotoAndStop(frame);
	if (frame == 2) {
	 _parent.attachMovie("dooropen", 'dooropen'+openwall, 620+openwall);
	 _parent['dooropen'+openwall]._x = wall_A[openwall].x+wall_A[openwall].vwidth/2;
	 _parent['dooropen'+openwall]._y = wall_A[openwall].y+wall_A[openwall].vheight/2;
	 _parent['dooropen'+openwall].corrwall = openwall;
	 _parent['dooropen'+openwall].onEnterFrame = opendoor(doordir);
	}
	this.wall_nbr[openwall] = 1;
	break;
}
}
}
function opendoor(dir) {
trace(this.corrwall)
switch (dir) {
case 1 :
if (Math.sqrt((_parent.unit._x-this._x)*(_parent.unit._x-this._x)+(this._y-_parent.unit._y)*(this._y-_parent.unit._y))<10) {
	if (_parent['wall'+this.corrwall]._height>0) {
	 _parent['wall'+this.corrwall]._height--;
	 wall_A[corrwall].vheight--;
	}
} else {
	if (_parent['wall'+this.corrwall]._height<15) {
	 _parent['wall'+this.corrwall]._height++;
	 wall_A[corrwall].vheight++;
	}
}
break;
}
}

theres my code. if u look a little bit down on the first function it says
_parent[‘dooropen’+openwall].corrwall = openwall;
putting the value of openwall which i checked is 5 into my door mc that was just made. But when i try to look at the value in function opendoor it doesn’t work. It says unidentified but it should have a value. notefunction opendoor is called with onEnterFrame by my door mc. Can anyone figure out why the openwall isn’t being put into my mc or why i can’t call it with the trace command in opendoor? Am i using the this command corectly(anything could be worng…)