My won't it gotoandplay?

Hi there, I’m a newbie, nice site, nice tutorials. I’m also a bit new to flash and got a problem with a gotoAndPlay() command that isn’t working properly. I’m sure an experienced flasher will solve it easily-

I just written my first game and just cleaning things up, adding a highscore table and stuff. The main swf has 3 frames - the first shows the title screen, the second the game and the third an endgame screen. You click play from the titles to got to next frame and play the game - its in AS 2.0 and _root.onEnterFramev function is used to start the game. When you run out of lives, a function is called that moves main swf to the next frame, the endgame screen. You can restart a new game or go to titles. The restart button works fine but the titles does not. It flicks back to first frame very briefly then back to where it started. Why is this? Both buttons are virtually identical except going to different frames. Is it to do with leftover resources from the game or something more obvious? Is there a way to debug things like this in flashmx? Can anybody help?

shouldn’t you use gotoAndStop() ? didn’t read everything you wrote, but as i understod it, thats the command you should use…

Could you post your .fla? It would be most helpful.

are the paths ok?? check the paths, other than that without looking at your fla i can’t help u much more…

gotoAndStop() makes zero difference. There is a lot of code here but here is the main stuff:

first frame: starts game

Has play button with this script:

on(release){
Display.clearResults();
_root.gotoAndPlay(2)
}

2nd frame: game

Intitlaizes all da vars and inits game and starts it with this code:

stop();
// attach Ship
attachMovie(“saucer”, “myShip”, 50);
myShip._x = 50;
myShip._y = 50;
var enA = new Array(4);
var bulletA = new Array(5);
var bombA = new Array(5);
var enBullA = new Array(7);

for (var i =0;i<5;i++){
attachMovie(“laser_mc”, “laser”+i, 100+i);
bulletA* = _root[“laser”+i];
}
for(var i=0;i<5;i++){
attachMovie(“bomb_mc”,“bomb”+i,300+i);
bombA* = _root[“bomb”+i];
}
// -------- ATTACH ENEMY ARRAY -------------
for (var j = 0; j<4; j++) {

if(j<3){//attach enemyships
attachMovie(“enemy1”, “en_ship”+j, 500+j);
enA[j] = _root[“en_ship”+j];
} else {
//attach enemytanks
attachMovie(“en_tank”, “en_tank”+j, 500+j);
enA[j] = _root[“en_tank”+j];
}
}
// ==== attach enemy bullet array =====
for (var i = 0; i<7; i++) {
attachMovie(“en_bullet2”, “bullet”+i, 700+i);
enBullA* = _root[“bullet”+i];
}
var myGame = new Game(myShip, enA, bulletA, bombA, enBullA);
// ======= Key capture ============ //
laserListener = new Object();
laserListener.onKeyDown = function() {
myGame.fireLaser();
};
bombListener = new Object();
bombListener.onKeyDown = function() {
myGame.fireBomb();
};
Key.addListener(laserListener);
Key.addListener(bombListener);
// initialise game
myGame.initGame();
Sounds.siren.start();
// game loop
_root.onEnterFrame = function() {
myGame.startGame();

};

A method in the Game class checks if all lives are lost - if so the game ends and we gotoandStop(3):

has a restart button and titlescreen button:

restart works thusly:

on(release){
Display.clearResults()
_root.gotoAndStop(2)
}

titlescreen does <<<not>>>> work thusly:

on(release){
Display.clearText();
_root.gotoAndStop(1);
}

Like i said. it flicks to the title screen very quickly and then back again. I’m not sure if the code i given will help solve the problem but i hope so. It seems like either a bug in Flash (i doubt it) or user error. The latter is much more likely:) There must be another instance where this sort of thing has happened to someone else here?