PDA

View Full Version : Button on top of another button?



elburrodiablo
August 28th, 2007, 02:30 PM
This may sound odd, but I need to place an invisible button on top of another functioning button (which is inside a movie clip.)

I'm creating a scrolling thumbnail gallery, which I have working...however the boss would like the the gallery to scroll when the mouse gets near the top and the bottom of the scrolling thumbnails...which means that I need the actual thumbnails to remain clickable in those areas, yet I need to to some set my scroll function upon entering these areas.

Obviously, an actual button on top of another actual button is not going to work as the button on top will override the button underneath.

Someone mentioned something about using a Mouse Track...which I'm assuming creates a clickable area on the stage using x/y coordinates.

Any ideas would be greatly appreciated. Thanks!

By the way...here's the page I'm trying to add these "invisible buttons" to: http://www.gelia.com/work.html

cesig
August 28th, 2007, 02:47 PM
Well, you actually can place a button inside a button and make it work, but in this case, it sounds like it wouldn't solve your problem.

Probably the easiest way to do it would be to periodically check the position of the mouse, and if the cursor is within a specific area, trigger the scroll function.

cesig
August 28th, 2007, 02:50 PM
Or, extend the hit states of the two arrow buttons to cover the entire area you want the scrolling to be triggered in. Then, overlay the thumbnail images on top of those buttons, so that the MOUSE_OVER is triggered for the arrow buttons most of the time, except when over a thumbnail.

This is really kind of a hack, and I wouldn't recommend it, but it would probably get you what you want.

elburrodiablo
August 28th, 2007, 03:03 PM
Or, extend the hit states of the two arrow buttons to cover the entire area you want the scrolling to be triggered in. Then, overlay the thumbnail images on top of those buttons, so that the MOUSE_OVER is triggered for the arrow buttons most of the time, except when over a thumbnail.

This is really kind of a hack, and I wouldn't recommend it, but it would probably get you what you want.

Thanks for the recommendation, but I actually tried that exact scenario. Haha...unfortunately, it was shot down by the boss.

cesig
August 28th, 2007, 05:26 PM
Just our of curiosity:
What was the reasoning behind your boss shooting the idea down? And why is s/he making those sorts of tech decisions?

Regardless, my first suggestion should work.

soulwire
August 28th, 2007, 05:43 PM
Have you looked at the MouseEvent.MOUSE_MOVE method?

You could just put a conditional statement in here to detect the y position of the mouse to trigger your scroll function. no need for dummy buttons.

fetus
August 28th, 2007, 05:52 PM
Forgive me if I'm wrong, but I believe both buttons should receive the mouse events? I swore the other day I have 2 buttons getting the onclick because of bubbling. Previously in AS2 this would never happen.