-
If statement problem
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 ?
-
Apparently the problem is that, this if statement is executed once at the very beginning and then it's done.
What I need is checking it all the time. However, a simple while loop doesn't work as well.
-
.
Hi,
One of many ways of achieving this could be by using an onEnterFrame() , like so
PHP Code:
onEnterFrame = function ()
{
if (stain1.val1 == 1 && stain2.val2 == 1)
{
delete onEnterFrame;
gotoAndPlay(2);
}
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|