I recommend incrementing your index before your go to and play...better coding practice, plus I'm not sure how flash interprets commands after a Goto statment..
if (index < 2)
Set Variable:"index" = "index + 1"
Go to and Play (1)
End If
The following code works but it will not loop when it is replayed:
If(index = 1)
stop
Else
Set Variable:"index" = "1"
End If
So the following statement is added before the if...else statement:
Set Variable:"index" = "0"
But this cause the infinite loop again.
I think the reason is because....
when the index is first set to 0, it will enter the else loop, so index will become 1 and come out of the loop. Then it will start from the begining of the coding again. And the index is set to 0 again and went into the else loop again.
This will cause it to loop infinitely.
So I tried to search Flash Help whether it has while loop. I think it doesn't, only have Loop While(). So I tried the following:
Set Variable:"index" = "0"
Loop While(index < 2)
If(index = 1)
stop
Else
Set Variable:"index" = "1"
End If
End Loop
However, this doesn't help too. Anyway, my assignment is done. Just want to know why it cannot loop twice when it is replayed.
Thanks a lot. If you have a better way to loop a movie, do let me know.
I assume when you say "loop a movie twice", what you want is to play your movie 2 times and stop it. Following that theory:
Last frame of movie:
If (count < 1)...(or N)
Set Variable: "count" = count + 1
Go to and Play(1)
Else
Stop
End If
Where "count" will always = (boolean)0 if it hasn't been initialized, as in the first play of the movie. This makes the movie into a 2 frame loop...another way to loop instead of using "Loop While"...you can also control the speed of the loop by adding frames between the keyframes.
For frame 1's initializing of "count" = 1 (or more):
Frame 1:
Set Variable: "count" = 1 (or n)
Frame 2:
No actions
Frame 3
If (count < N)
Set Variable: "count" = count + 1
Go to and Play(2)
Else
Stop
End If
Make the 1rst and 2nd frames of your movie identical.
Use the loop code that was working for you without reseting the variable to 0 at the beginning.
Except have the go to pointing at frame 2.
have variable = 0
at frame 1
then a go to a play frame 3
(so that you don't play the duplicate frame in 2)