I have 2 different movieclips named stain1 and stain2

in stain1 there is a integer variable "val1" which is initially = 0
in stain2 there is another integer named "val2" and its value is also = 0

At the end of each movieclip, I set these values to "1"

Now, in my main stage, I have "stop();" command for one of the layers and after this command there is a if statement which goes like;


if(stain1.val1 == 1 && stain2.val2 == 1)
{
gotoAndPlay(2);
}

By this code what I want to do is after finishing the animations in both stain1 and stain2 movieclips, playing the main stage.
But it doesn't work. I traced the val1 and val2 values, they becomes 1 however this if statement doesn't work. Even tried to write something like trace("test"), but even this message has not been traced.

So, what might be the problem ?