Skip navigation
Frozen Harlequin
Currently Being Moderated

Buttons Overlap Each Other -> Problems with Mouse Over

Mar 3, 2013 8:29 PM

Tags: #action_script_3 #overlap #overlay #bounding_box #mouse_over #bounding_boxes #button_overlap #hit_area

Hi !

First off: I'm pretty much a total Flash noob. I've tried finding an answer to this online and in the FAQ but it's entirely possible that this is still an amazingly stupid question or that my analysis of the problem is completely incorrect .

I'm working on a simple Flash (AS3) presentation for uni in Flash Professional CS6 that looks roughly like this:

Flash_Help01.jpg

 

The grey boxes with numbers in them are my buttons. They've got mouse over effects on them. However, the problem is that those mouse over effects sometimes only work when the mouse is over specific parts of the boxes. I think that's because the boxes are slanted which results in their bounding boxes overlapping each other like this (the bounding box in this image is that of box 9):

Flash_Help02.jpg

I think that this is the problem because the edge of the bounding box pretty much lines up with the area in which the mous over effect of the + box won't work.

 

Now the easiest solution would be to just resize the grey boxes, of course. However, it's not that simple as I've created the whole design in Photoshop and then imported it into Flash. So that means I can't resize the boxes without messing up their rotation angle or the numbers and I would hate to have to resize them in Photoshop because I've already put quite some work into the Flash file. I was hoping there might be a way to tell Flash to ignore the bounding boxes. I've already tried using masks to define the Hit area but that doesn't seem to help with mouse overs. So yeah...any ideas would be appreciated. And like I said: I'm a Flash noob so it would be great if you could keep it as simple as possible . Thanks !

 
Replies
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 3, 2013 8:56 PM   in reply to Frozen Harlequin

    convert the white disk to a movieclip and assign mouse listener to it (that does nothing in the listener function).  that will prevent mouse overs while the mouse is over the white disk.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2013 8:08 AM   in reply to Frozen Harlequin

    if you convert that disk to a movieclip, the rectangles will not respond to the mouse when the mouse is over the disk.  if that's the only location where there is a mouse problem, that will solve the problem.

     

    if there's a problem when the mouse is outside that disk, converting the disk to a movieclip will not solve the problem.

     

    all that said, i'm not sure you understand the cause of your problem because flash does NOT use bounding boxes for mouse events.  ie, clicking inside a bounding box where there is no shape, will NOT trigger a mouse event.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2013 8:42 AM   in reply to Frozen Harlequin

    Your best bet is to create a MovieClip that matches the dimensions of your intended mouse area and set that as the hitArea:

     

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/display/Sprite.html#hitArea

     

    Depending on how the symbol is setup the extra whitespace around the symbols can and will affect mouse input. (The symbols are made from bitmaps instead of vector for instance or there is shape data that isn't visible or another shape/symbol is stretching the area)

     

    Let me know if you need any further instructions on how to implement this method.

     

    EDIT:

     

    If you are using SimpleButton you just define the shape in the "Hit" frame of the button.

     

    Quick Google search revealed this: http://www.echoecho.com/flashbuttons01.htm which seems to go over what I was suggesting for the second case.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 16, 2013 7:35 PM   in reply to Nabren

    I think the problem is that you're working with alpha PNG files from Photoshop. The alpha part of the image will read has solid. Try creating a mask layer from within your symbol that only reveals the diagonal rectangles.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points