Situation : I have a "bubble image" virtually transparent, like a realistic bubble. I have this image as the icon of a button, floating up the screen.
When the user touches the bubble it pop's (i swap the icon for a popped bubble).
Problem : It works kind of fine, on mouseDown i get the name of the target and handle the pop. But bubbles are round and buttons are square, so you are able to pop the bubble, when touching outside the bubble, but within the button.
Quandry : I just went ahead and changed everything... I abandoned buttons in favor of just the bubble images, thinking, well, you cant trigger my handler unless you actually touch within the pixels of the bubble.
Problem got worse

So my hope of a solution is : ..
Hopefully there is a way to do something like what intersect does. with the intersect function you can specify "pixels" or "opaque pixels"
So is there any way i could do something in this handler, that will only continue if the touch is on "pixels" of the button "bubble1"
Code: Select all
on pixelsOfButtonSelected
// don't know how to test this though
end pixelsOfButtonSelected
on mouseDown
put the short name of the target into tTarget --tTargetBubble
if tTarget contains "bubble" then
if pixelsOfButtonSelected then -- maybe i could do something like this handling the detection in another handler
put char -1 of tTarget into tBubbleNumber
clone group ("bubbleGroup" & tBubbleNumber)
set the name of the last group to "poppedgroup"
set the name of the button ("bubble" & tBubbleNumber) of group "poppedgroup" to "poppedBubble"
put the text of field ("sumField" & tBubbleNumber) of group "poppedgroup" & comma after field "displaySum"
set the visible of field ("sumField" & tBubbleNumber) of group "poppedgroup" to false
loadIcon "poppedBubble", "bubblepop"
delete variable sBubbleNames[("bubbleGroup" & tBubbleNumber)]
delete group ("bubbleGroup" & tBubbleNumber)
wait 50 milliseconds with messages
delete group "poppedgroup"
if the keys of sBubbleNames is empty then
evaluateTheSum
end if
end if
end if
end mouseDown