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?