Main menu on game

I have created a menu for my game with buttons and whatnot as a separate .fla file named Menu. My actual game is another .fla file called Game.fla. I was wondering what the best way would be of loading this menu before the game plays?



I would suggest that you create a .swc with your Menu.fla, and then just add that .swc to your Game.fla

If you are using CS6, make sure that you are setting linkage for any MovieClips you want to create instances of in your code.

In the actionscript settings on the library path tab, you can add a .swc that will be included into your .swf when compiling.

In your code, you can now create an instance and add to the display list :

// Assuming MainMenu was a movieclip with linkage set in your .swc 
var mainMenu:MainMenu = new MainMenu;

I should note that this does not load the .swc at runtime, it includes the .swc to your .swf at compile time. I would recommend this method over loading a .swf in most cases. Cases where I might not, is if there was a large amount of content that wasn't needed all at once. That would allow you to minimize the amount of memory you were using and reduce the .swf size of your main .swf so it loads quicker.

Anytime you are loading .swf's in at runtime you are adding another layer of complexity, so I'd not recommend it unless you do have a good reason to do so. From what you have described, this doesn't sound like a situation where I'd load an external .swf at runtime.

Load the swf output from Menu.fla and keep a check on the progressEvent from loader. Don't show the game screen until Menu.swf is completely loaded and initialized.

Some more details wrt comment from OP: You can you to load external swfs. init Event would mark that the swf's actionscript has started executing. OTOH, complete event would tell that all the swf bytes have been loaded.

Need Your Help

Help with structuremap configuration configuration structuremap

I am trying to configure Structuremap something like the following but I can seem to get it quite right

Using Gridify after images finish loading ascyncronously

javascript jquery backbone.js gridify

I am building an app in Backbone.js and using gridify to arrange my photos in a grid fashion. The problem is that the images get loaded asynchronously and this seems to be causing gridify issues. ...