A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: How to make a pop up menu?

  1. #1
    Member
    Join Date
    Jul 2012
    Posts
    71

    How to make a pop up menu?

    Ok, you know how in games if you click a button that says Menu
    a sub menu will pop up on the screen? How would I make that in Flash?

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    That could be done with some coding, but that's a bit too advanced for you. Just use a MovieClip and have many frames inside it, when you press a button in your Menu, on your MovieClip with many frames (each frame is a submenu), just use gotoAndPlay() to go to a frame on your MovieClip where a submenu is

    Sample button code:

    Actionscript Code:
    on(release){
        submenu_mc.gotoAndPlay(2);
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Member
    Join Date
    Jul 2012
    Posts
    71
    oh wow, that is kind of advanced...
    aish, I'll figure it out some sort of way...
    Thanks a bunch

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    71
    EDIT:I think I'm on to something here...
    So here's what I did: I created my movieclip (which will be the submenu) and added a linkage for actionscpript to it.
    Then I clicked on the main menu button and added this code:
    on (release) {
    gotoAndPlay("menuboo_mc");
    }
    (*note: my submenu movieclip is called menuboo*)
    But then it didn't work ^^;
    So then what I did was stare at your instructions for 5 minutes and realized that I was close.
    Any ideas?

  5. #5
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Pretty close

    I hope you know what I mean when I say that you need to give your movieclip an Instance Name (its normal Library name is what you call it when you are converting it to a MovieClip, and I do NOT mean that), so, let's say your Movieclip has the instance name, menuboo_mc (yup, with _mc after it, because that is not you need to do in order to show that it's a movieclip, it's just a way of naming movieclips in Flash, just a programmer's habit :P). Your code looks good, except for that, inside gotoAndPlay(), you don't type the movieclip instance name, rather, you type the Frame Number of which frame you want to go to inside your MovieClip, and you add its instance name BEFORE gotoAndPlay, implying that it is INSIDE the MovieClip and NOT outside the movieclip you are going to another frame

    Actionscript Code:
    on (release) {
        menuboo_mc.gotoAndPlay(3);
    }

    this however requires you to have stop(); in each frame of your Movieclip, because gotoAndPlay means that it will go to the specified Frame and PLAY from there. If you want it to stop there, without having to manually type stop() in each Frame, use gotoAndStop instead:

    Actionscript Code:
    on (release) {
        menuboo_mc.gotoAndStop(3);
    }

    I really do advice you to use gotoAndStop, because you may encounter a common error with gotoAndPlay...

    Hope it works
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  6. #6
    Member
    Join Date
    Jul 2012
    Posts
    71
    Ok I followed your steps precisely,but when I tested my movie, my sub menu didn't pop up. I only have 1 frame in the sub menu, so I changed the code to this:
    Actionscript Code:
    on (release) {
        menuboo_mc.gotoAndStop(1);
    }
    Any ideas? Do you think I might have to remove the linkage to actionscript?
    Oh and I do know what an instance name is. I gave my sub menu mc the instance name menuboo_mc like you said. Should I give the main menu the instance name?
    And gotoAndStop is a really good idea

  7. #7
    Member
    Join Date
    Jul 2012
    Posts
    71
    ok never mind I got it http://legiokat.deviantart.com/art/h...lash-323191019
    thanks again~

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