SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Navigation Help? ExampleIncluded

    Hey guys,

    I just started building a navigation and ran into a small problem.

    I'm trying to build a very basic dropdown navigation, here's what I have so far...

    http://www.mariodabrowski.com/Examples/navigation/

    The only thing I cannot figure out is how to keep the menu from dissapearing when you roll off the button?

    I will have sub buttons within each section so having the menu stay when the user has the cursor over it is very important.

    Any help would be greatful,
    Thanks,
    Mario

    P.S. I've also included the .fla if anybody wants to look at the code or use the menu for some other purpose.
    Attached Files Attached Files
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net

  2. #2
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do the following :

    Once the drop-down menu appears you tell it to stop and then just set an enterFrame event to check if the mouse is still within the boundaries of the dropdown.

    Code Actionscript:
    _root.onEnterFrame = function(){
        if(!mc.hitTest(_xmouse, _ymouse)){
                                    gotoAndPlay("start");
                                     }
     
    }
    and don't forget to delete the enterFrame event afterwards.


    Good luck


  3. #3
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the reply krityx.

    I got the menu to stay open, however when you leave the boundaries of the box it still stays open. I'm sure this is why you mentioned "and don't forget to delete the enterFrame event afterwards."

    Can anybody help me with that last part, I'm not a AS coder and am not sure how to delete the enterframe, or get the box to disappear if the hit test fails.
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net

  4. #4
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the code i gave you is actually meant to make it disappear once your mouse pointer is not over the movieclip (hence the ! (negation) ) so

    if(!mc.hitTest(_xmouse, _ymouse)) means something like if the mouse isn't over that mc then go to the frame label "start". and on that frame label the menu should be invisible for the effect to be achieved.

    You have to delete the enterframe if you dont want it to run endlessly.

    Code actionscript:
    _root.onEnterFrame = function(){
        if(!mc.hitTest(_xmouse, _ymouse)){
               gotoAndPlay("start");
                     delete this.onEnterFrame;
      }
     
    }


  5. #5
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    Thank you for the generous reply.

    I'm having a bit of trouble figuring out where to put the code. I've tried on the mc, on the timeline, within the mc, and I keep getting errors.

    Code:
    Statment must appear within on /onClipEvent handler
    I have attached my latest source file. Can anybody help me figure out where this piece of code will work?

    Thanks again,
    Mario
    Attached Files Attached Files
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net

  6. #6
    SitePoint Addict dgroves's Avatar
    Join Date
    Jan 2007
    Location
    Bath, UK
    Posts
    364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am no Flash expert, but what I would like to say is, very nice menu! I Like!

  7. #7
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ethics View Post
    I have attached my latest source file. Can anybody help me figure out where this piece of code will work?
    The menu in the file you posted doesn't work. I mean on roll over no drop down apears it just does that effect on the actual button.

    Anyway, you need to post that code on the last frame of the animation where the drop down fades in. so when it has completely faded in you tell it to stop and then put that code in there. also make sure you have a frame label called start in the same movieclip where the drop down fades out or just simply disappears.


  8. #8
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey krityx,

    The last file I attached should be working with dropdowns on 2 of the buttons.

    I cannot seem to get this working. Would anyone be able to throw together a simple example file of this working? Or even use my fla to see if it works?

    Thank you,
    Mario
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net

  9. #9
    SitePoint Guru krityx's Avatar
    Join Date
    Jan 2006
    Location
    Around
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that file doesn't work on my end. sorry.

    i've attached an example of a menu like that working

    you can also check out a tutorial of making a drop down that uses invisible buttons like this : http://www.toxiclab.org/tutorial.asp?ID=47 . I think you may find this a little bit easier to do.
    Attached Files Attached Files



Bookmarks

Posting Permissions

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