dcsimg
A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Simple Menu Button issue

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    20

    Simple Menu Button issue

    I have a menu button. When this button is pressed the drop down menu appears. The whole actual functioning menu works great as it is fairly simple to create, but what I can't get to work is a button within the menu that drops down.

    I first saw this example in a flash movie I downloaded here and have attempted to basically recreate it, except to not use action script on the buttons themselves, but rather from the main time line for good coding practice.

    I attached a REALLY simple version of this. As you can see pressing the green button after the menu appears does nothing instead of tracing "works".
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    use movieclips for buttons, its easier :P i NEVER EVER use buttons, thats just my own preferance though anyway to the point, if you have a button inside a movieclip(i dont know if it works with a button inside a button) then your not typing just that buttons instance name, you need to type the movieclips aswel, im sure thats how it works anyway so
    mcmenu is the movieclip with the button in (movieclips instance name)
    btn1 is the button inside the movieclip (buttons instance name)
    mcmenu.btn1.onPress = function() {
    //whatever the script does
    }

    try that, i hope it works 8)

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    20
    Thanks for the reply Milna, but that is exactly what I have done if you viewed the file. I never use the actual button symbol. The actionscript you posted is the exact same I have on my main timeline for the inside button (movieclip instance) I have created.

    I have done more in depth button usages and I can't figure out why this doesn't work. This isn't a issue with the visible function either in the AS because I have tried switching to having the menu slide down into the main movie with masks and have tried using a fading / incrementing alpha. I simply used the visible property here to prove the point that I can't get a (movie instance) button to work inside another.
    Last edited by Roa33; 07-20-2010 at 02:54 PM.

  4. #4
    Senior Member
    Join Date
    Apr 2009
    Posts
    117
    hmm, the outer MC will be over powering the inner MC, put MOUSE ROLLOVER function on the outer mc to bring the menu up and use onPress function or whatever on the button inside the menu but youll also need the rollover function on the other buttons in the menu aswel, so

    Code:
    menu1.onRollOver = function() {
    //script that opens menu here
    }
    menu1.innerbtn1.onRollOver = function() {
    //script that opens menu here
    }
    menu1.onRollOut = function() {
    //script that closes menu here
    }
    menu1.innerbtn1.onRelease = function() {
    //whatever the btn does
    }
    thats from the top of my head, might not work, but youll get it after youve read it

    menu1 is the menu mc
    innerbtn1 is the mc in the menu mc

    dont forget to change these instance names

  5. #5
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    Like you, I'm confused by this problem, and I don't really have an explanation or solution for you. I have worked a few things out, however, which may help you.

    Firstly, it is your code:
    PHP Code:
    btn.onRollOut menu.onRollOut = function(){
        
    menu._visible false;
        } 
    which is the problem. If you comment that out, the rest of it works exactly how it should. I haven't the faintest idea why this would be. Of course, this leaves you with the problem of how to make the drop down go away afterwards.

    Nothing I tried really worked, so I put together a little work around of having the dropdown disappearing on the rollover of an invisble button that surrounds the main button and the menu. Doubtless there would be a better way of doing this, but unfortunately you'd have to find someone more pro than me to tell you how :O

    I've attached my little work around, hopefully this helps or at least gives you some ideas. If you ever sort this out properly do post the solution, because I for one would be keen to hear what the problem is.
    Attached Files Attached Files

  6. #6
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    Ah, just realised that I attached a CS4 version of the file. Here it is in CS3, that's the oldest version I can make it so hopefully you are able to open it.
    Attached Files Attached Files

  7. #7
    Junior Member
    Join Date
    Aug 2007
    Posts
    20
    Sorry Ribbibarnes I can't view CS3+ because I have flash 8. I tried your solution milna93, but I'm still having the issue of the top movieclip not being recognized as "on top". It seems as though anything that moves cannot have an inner btn, but I have seen this before its nothing special. Just can't figure it out.

  8. #8
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    I managed to make a version for Flash 8 - my colleague is still running CS3, so we can work our way back.

    Do give it a go and see if it works for you, if not I could describe what I mean in more detail. The key point is that is you comment out the bit of code I mentioned before, the other code works, so at least that may give you a place to start trying to work it out.
    Attached Files Attached Files

  9. #9
    Junior Member
    Join Date
    Aug 2007
    Posts
    20
    Thanks Rickibarnes, the workaround will have to do for now, but I find it so strange that by adding the onRollOver event causes the movie referenced to be brought to the top or mix up the level of the movies within.

  10. #10
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    I know, it seems completely weird to me, too! I can't even begin to imagine why that would be.

  11. #11
    Senior Member
    Join Date
    Mar 2010
    Posts
    157
    Maybe you should but the menu in another MC and make that _visible = true or false...

  12. #12
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    That's how it already is, it doesn't work.

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