How to make Dropdown menu?
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: How to make Dropdown menu?

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    7

    How to make Dropdown menu?

    Hi

    I've tried making a dropdown button for ages but i usually always get some sort of error.

    I'm using Flash MX (the original) and I also have Flash MX 2004.


    Anyone tried making one? How do u do it?

  2. #2
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    a step by step guide would be appreciated

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    I have made a button on keyframe 1, when its clicked it should move to keyframe 10.

    Its basic actionscript:

    stop()
    onMouseDown = function(){
    gotoAndPlay (10)


    But i get this error (and when the flash file is tested/played, it doesnt stop):


    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
    stop()

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Statement must appear within on/onClipEvent handler
    onMouseDown = function(){

    Total ActionScript Errors: 2 Reported Errors: 2

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Hi I don't have a "step by step" answer for you, but I can help with your error code. It looks like you put your "stop();" code on the button and are using the wrong function declaration type as well.

    It sounds like you will need to use ActionScript 2 since you have an older version of flash.

    Your action script will need to be broken up into two locations:
    1) on the timeline: This is where your stop(); goes. Put a stop on frame 1 and another on frame 10
    2) on the button: you need to change your code to say:
    Code:
    on(press){
    play();
    }
    //If you say gotoAndPlay(10) you are telling flash to jump to frame 10 and play from that point, i think you want to play the movie from current location and stop at 10.

  5. #5
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Quote Originally Posted by jkell View Post
    Hi I don't have a "step by step" answer for you, but I can help with your error code. It looks like you put your "stop();" code on the button and are using the wrong function declaration type as well.

    It sounds like you will need to use ActionScript 2 since you have an older version of flash.

    Your action script will need to be broken up into two locations:
    1) on the timeline: This is where your stop(); goes. Put a stop on frame 1 and another on frame 10
    2) on the button: you need to change your code to say:
    Code:
    on(press){
    play();
    }
    //If you say gotoAndPlay(10) you are telling flash to jump to frame 10 and play from that point, i think you want to play the movie from current location and stop at 10.

    Kool, that's helped alot thanks jkell.

    I have a question though, you see where you writ the code: play()

    Do i have to write the keyframe i want to target in the brackets?



    I've tried doing that, whenever i do, i get an error. Whenever i don't write a keyframe number in the brackets, i don't get an error.

    If i have alot of buttons which i want to 'play', i can't specify which keyframe i want it to link to.

  6. #6
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Can you tell me more about the: gotoAndPlay; code too (i wouldn't mind knowing any codes which might help me in making a dropdown box which contains graphics)


    I've been trying to link a keyframe [button] to another keyframe (i've added the Stops so the timeline doesn't flow).

    But it doesn't link up to the future keyframe.


    Quite frustrating because this is supposed to be the basics, lol.


    Many thanks
    Last edited by DeenShow; 01-17-2014 at 05:59 PM.
    The strong is not the one who overcomes the people by his strength, but the strong is the one who controls himself while angry." - Muhammad.

  7. #7
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Quote Originally Posted by DeenShow View Post
    Kool, that's helped alot thanks jkell.

    I have a question though, you see where you writ the code: play()

    Do i have to write the keyframe i want to target in the brackets?



    I've tried doing that, whenever i do, i get an error. Whenever i don't write a keyframe number in the brackets, i don't get an error.

    If i have alot of buttons which i want to 'play', i can't specify which keyframe i want it to link to.
    Perhaps I dont understand what you are trying to do exactly. If you are wanting a button to do a drop down, The drop down animation should should be inside that button. I would attach a sample file, but I dont have the ability to save back to 2004.

    As far as the gotoAndPlay(15); vs play(); They both will start playing the movie

    gotoAndPlay(***) will jump the playhead to either a ***Frame Label or *** Frame number and then begin playing.

    play(); does not need anything inside the perenthesis and starts playing from the current location.

  8. #8
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Quote Originally Posted by jkell View Post
    If you are wanting a button to do a drop down, The drop down animation should should be inside that button. I would attach a sample file, but I dont have the ability to save back to 2004.
    I would want that exactly, i just don't know how to do it..

    So i tried to make a Graphic, convert it into a button and then click on it to show other graphics [in a different keyframe] (which i would also make into buttons, which would also connect to other keyframes).


    Is that the correct method to do it?

    My problem is whenever i make buttons, i can't actually link them to a different keyframe (i've tried the gotoAndStop/gotoAndPlay method [mentioning the frame they should connect to] but nothing happens, just errors.



    My questions:

    1 - What's the real method to make buttons with a dropdown (containing graphics) easily?

    2 - If my gotoAndPlay idea is correct, why can't i connect to another frame?
    The strong is not the one who overcomes the people by his strength, but the strong is the one who controls himself while angry." - Muhammad.

  9. #9
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Also one more thing, do u think there's a trick to use the Combo-box (a default dropdown box in the Components section), enlarge it, and add graphics in it somehow?

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