Add an instance variable for the door and one for the button (i used the name "ID" for both)
When you add an instance of each object in the layout, set the value of the button instance's variable to the value of the door instance's variable, individualy, on the properties bar to the left, and then add an event to check if they have the same value when you click the button. if it's true, the door opens (in my example, it fades) <img src="smileys/smiley1.gif" border="0" align="middle">
here, i made an example 'cause i'm not very good explaining <img src="smileys/smiley36.gif" border="0" align="middle">