First of all you should put the level_load command into an own function that starts with

Code:
my=NULL;


to be sure that this function is still running after the level_load commnand has been executed, because you should add at least a

Code:
wait(1);


after the level_load();

Try something like that (I have not tested this code):

Code:
action door()
{
	set(my, POLYGON);
	my.emask |= ENABLE_CLICK;
	my.event = door_open;
}

void load_new_level(STRING* level_name)
{
	my = NULL;	
	level_load(level_name);
	wait(1);
}

function door_open()
{
	var door_percentage;
	if((event_type == EVENT_CLICK) && (vec_dist(player, my) <= 100))
	{
		while(door_percentage < 100)
		{
			ent_animate(my, "open", door_percentage, 0);
			door_percentage += 3 * time_step;
			wait(1);
		}
		in_building = 1;		
		if(door_percentage >= 100) load_new_level(str_create(my.string1));
	}
}


Regards,
Pegamode.