PDA

View Full Version : just a thought on navigating frames



farban
March 8th, 2009, 08:06 PM
Since my project uses class actionscript files my whole game project runs on one frame and nothing is on the maintimeline so there is only just one frame on the timeline. Just wondering how I could make it so that I could have the first frame with game instructions and a description which then goes into the game being second frame and when gameover goes to third frame using actionscript. or any tutorials or some peice of advice

dandylion13
March 8th, 2009, 09:08 PM
Assuming that you're programing in the document class, You could try this:

gotoAndStop(2);

You might find for games though that using frames for what you're trying to do is not the best way. You can run into all sorts of problems with object references turning up null when you don't exepct them to which could cause a bit of a debugging nightmare (I've been there!) Frames are great for object states ("flying", "exploding", "shooting" etc) where you store the visual states of objects but not with game screens.

You might want to create your seperate game screens as seperate MovieClip objects and add and remove them (with addChild and removeChild) as you need them.

farban
March 8th, 2009, 09:26 PM
Yea my project uses a engine.as for the document class and the other as. files are object classes for the movieclips. Really cant figure out how i could put a mainmenu in and a gameover screen.

scottc
March 8th, 2009, 09:45 PM
You could treat your game like any other object...

just make a new document class, and set engine.as as an import.

var menu:Menu = new Menu();
addChild(menu);

//wait for events and such...

removeChild(menu);
var game:Engine = new Engine(...args);
addChild(game);

//etc