This content has been marked as final. Show 9 replies
> what can i do to make it work?
I'm not sure I understand your question, exactly. What you've shown
will work for both the parent and the child, one or the other. Are you
trying to get both to respond?
Co-author, Foundation Flash CS3 for Designers
"Luck is the residue of good design."
Yes, I'm trying to get both of them to respond.
Is it possible?
You cannot do that directly. You can accomplish that by using a combination of an onRelease handler for one clip and hitTest coupled with a mouse event for the other.
is there another alternative to hitTest? because i have a lot of childs, and the all have to respond to a mouse click. and there parent mc is a huge mc that only ppart of it is visible (it has a mask applied to it) and i what that the user will be able to drag it in order to look for specific child and to click it.
and i have another function that is triggered from inside the childmc (because the original childmc is duplicated dynamicaly)
is there another alternative to hitTest?
Are you dragging the very large MC and leaving the mask fixed in place or is the MC fixed in place and you are dragging the mask?
And FWIW you can use the hitTest either on the parent MC or the children - whichever is more convenient. And in your case it sounds like it would be more convenient on the parent MC.
I am draging the parentmc.
i did it like that:
i added a listener to the mouse
and onMouseDown I startDrag and onMouseUp i stopDrag
and the onRelease is for the childrens.
The attached script I did just to illustrate a different point on another forum but I just modified it to be able to drag the "aquarium". Click on any of the three colored buttons under the white window as many times as you want to add fish to the window. Once swimming in the window, each "fish" can be deleted by pressing on it (i.e. each on has an onPress handler. But you can also drag the white window. It does coincidentally enough have a mask.
One issue with the hitTest/drag is that you may not want the MC to drag while you are actually interacting with the buttons contained within it. If that is the case, you can null out the hitTest while over the child buttons and then reapply it when you are off them. I took that previous script and made it so that the MC cannot be dragged if the mouse is over a child button. The changes are in lines 89 - 105