Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : gotoAndPlay


tralfaz
6/13/2004 3:42:26 PM

[quoted text, click to view]


Just think about that code there. It is onEnterFrame which means it
executes once for every frame. If the score is 6 you will jump to frame 5.
Then it will start to play to frame 6, but just when it gets to frame 6 that
onEnterFrame executes again and finds that the score is still 6.. and jumps
the timeline right back to 5 again. You are stuck at frame 5. The solution
is to stop that onEnterFrame when you are done with it...
have a good 1,
tralfaz

this.onEnterFrame = function() {
if (_root.score == 6) {
delete.this.onEnterFrame;
gotoAndPlay(5);
}
}

confusedAgain
6/13/2004 10:15:09 PM
Hi,
Im working on a simple matching game where if the user makes 6 correct
matches, the movie jumps to another part of the timeline where there is a short
animation. This is the code that is on the initial frame of the movie.

stop();
this.onEnterFrame = function() {
if (_root.score == 6) {
gotoAndPlay(5);
}
};

It now just goes to the 5th frame and stops. I cant figure out why. Any
suggestions?

thanks,
tc
fasterthanlight
6/13/2004 10:18:45 PM
did you try

if(_root.score eq "6"){
.........
..........
........



confusedAgain
6/13/2004 10:28:49 PM
No, but that part of the code works fine. It goes to frame 5 but then just stays there. Thank you though.

AddThis Social Bookmark Button