1

I have created two games in Flash and AS3 in different files and want to combine them with a menu created on a third file. Do I import them or copy paste them? Should the ActionScript be on the game line or should they all be in the same actions layer?

How do I set up the menu? Everything I do seems to mess it up somehow.

I have an animated start menu that has a Start and an About the Game button. When you click the Start button (start123_btn) it takes you to a menu where you can choose from two games (which I then want to hook up with the two games I have created and in those games I want a way to return to the main menu).

The About the Game button takes you to another button that gives some details about the games which I want that when they click it it takes them back to the main menu (frame 60).

Any advice?

  • So far all I have is 'import flash.events.MouseEvent; stop(); start123_btn.addEventListener(MouseEvent.CLICK, menu); function menu(event:MouseEvent):void { gotoAndStop(70) } about_btn123.addEventListener(MouseEvent.CLICK, about); function about(event:MouseEvent):void { gotoAndStop(60); }' – Funkypotato Dec 07 '12 at 13:43
  • I am kind of new at this so I'm still a bit confused as to how things are put together. – Funkypotato Dec 07 '12 at 13:50

1 Answers1

3

tl;dr

Create a third SWF that load each game using a Loader.
Add startGame() and stopGame() methods to each game to control them.

details

Create a wrapper that defines the menu and load each game. When the game is loaded, call startGame() to initialize the SWF. stopGame() could be called before closing the game.

public class Game1 extends MovieClip
{
    public function startGame():void
    {
        // ...
    }

    public function stopGame():void
    {
        // ...
    }

    // ...
}

Do the same with the second game.

Florent
  • 12,310
  • 10
  • 49
  • 58
  • Thank you, but if you could be more spesific, what do I put inside the brackets? – Funkypotato Dec 07 '12 at 13:52
  • When using a `Loader`, since its content is loaded, the constructor of the root object will be called. If you have put some game logic into it, you should move it into `startGame()`. – Florent Dec 07 '12 at 14:23