Flash8 Back button for menu?
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Back button for menu?

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    70

    Back button for menu?

    hello, I'm making a game and in the game there is a menu. I placed the menu on a frame all by itself. The problem i'm having is I'm not sure how to code
    the back button. When the player clicks the back button I would like them to be able to go back to the frame they were just on.
    For example: If I'm in the kitchen and hit Menu, I will be taken to the menu. Once I'm done viewing the menu I will click Back and return back to the kitchen. If I'm in my room and hit Menu, I will be taken to Menu. Once I finish viewing Menu I will be return back to my room.
    I hope what I'm asking is understandable......

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Are you different locations Kitchen/Room all on one timeline? If so it will be as having a single Menu instance on a layer above allyour rooms. This way the Menu will always be accessible no matter where you are.
    The Menu should be set up as a separate Movie Clip with a Blank keyframe on frame 1 (so it is not visible and wont appear until you want it to) and then your menu on a later frame on the same movie clip (you could use tweens to fade or move the menu into position). Be sure to put stop(); actions on frame 1 and on the frame you menu is on.

    Then Coding will be as simple as telling the Menu MovieClip to play(); It will play until the menu appears. Then when you want to go back, tell the Menu MovieClip to play(); again and it will go to frame one and take you back to any room.

    I hope that make sense, Let me know if you need actual help with the action script (AS2 or AS3)

  3. #3
    Member
    Join Date
    Jul 2012
    Posts
    70
    thank you for responding, im not sure I understand though
    so what I do is convert my menu into a movie clip and just tell it to play on release of a button?
    could you help me with the actual coding please? Im using as2

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    1) Create a MovieClip
    2) Create new Layer (above all other layers)
    3) Paste MovieClip in the new layer with just one Keyframe that last the whole timeline
    3a) Create a Menu Button (if you dont have one already
    4) Code your Button

    1)If you go to the frame with your Menu right now, you can select all and then press F8 on your keyboard ( you can choose what type of symbol to create:Button, MovieClip or Graphic). You want to choose a graphic. This will convert all the items of your menu into a MovieClip.

    Steps 2-3a are pretty self explanatory

    4) on the button you will add this in the actions window:
    on (press){
    //you will change MenuInstance name to the name of your menu
    MenuInstanceName.play();
    }


    If you can post a link to your FLA, I can show you how I would set it up.

  5. #5
    Member
    Join Date
    Jul 2012
    Posts
    70
    I think I understand now, but if you could show me that would be great!
    http://s000.tinyupload.com/index.php...80421989489501
    I just uploaded the menu, also my menu is 3 layers....

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Hello I opened up your file and made a working file. Unfortunately, I can not save back to FLASH 8 from CS6. If you download a trial of the new flash (free for 30 days) you can see what I did.

    http://s000.tinyupload.com/?file_id=...74247185729848

    You can down a .ZIP file with the .swf and .fla files.
    Screen Shot 2012-12-02 at 10.31.45 PM.png
    Above is how i set up the timeline for the main file.
    Below is how i set up the timeline for the MENU movie clip
    Screen Shot 2012-12-02 at 10.34.56 PM.png

    Let me know if you have any questions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com