Page 2 of 3
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:32 pm
by jacque
Klaus wrote: Fri Jan 21, 2022 8:01 pm
only "mousedown" in the card script will get fired when clicking a tranparent pixel.
Putting the mouseDown handler in the image should fix that. If there are several images add a behavior that catches the mouseDown message.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:37 pm
by richmond62
If folk had downloaded my stack with the octopus the rest of this discussion would not have taken place.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:42 pm
by Klaus
Come on, guys, Samuele wants to fire a "mousedown" when he clicks the transparent pixels of an image!
That is hard to misunderstand, and my stack shows the workaround, since this is not possible with a "mousedown"
handler in the image.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:53 pm
by richmond62
No, he doesn't, I am afraid you have things the
wrong way round.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 9:02 pm
by Klaus
Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 11:20 pm
by jacque
Klaus wrote: Fri Jan 21, 2022 9:02 pm
Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.
Opaque in this case means visible. He wants a mousedown to fire only if the pixels are visible.
Re: "opaque pixels"
Posted: Sat Jan 22, 2022 11:07 am
by Klaus
Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz.

Re: "opaque pixels"
Posted: Sat Jan 22, 2022 2:28 pm
by stam
Thanks guys that was a funny read
@samuele -- yes long and short of it is that PNG images will allow you to do this.
There is a lengthy discussion of this here:
viewtopic.php?f=7&t=35388&hilit=bullseye, i had jumped in halfway down the thread with a similar issue and came eventually to the conclusion that PNG is the only way to go, as Richmond advised then and now...
Stam
Re: "opaque pixels"
Posted: Sat Jan 22, 2022 6:57 pm
by jacque
Klaus wrote: Sat Jan 22, 2022 11:07 am
Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz.
Someone might think that English wasn't your first language.

But we still think you're clever.
Re: "opaque pixels"
Posted: Sat Jan 22, 2022 7:25 pm
by richmond62
Nobody should ever say that Klaus is anything but clever, but as we all get older he should
also be allowed the odd 'senior moment'.
It was Klaus, in 2001, who pointed out to me why one should generally use
mouseUp instead of
mouseDown,
and I will forgive him everything for that piece of invaluable advice.
And if he makes half the mistakes I do . . .

Re: "opaque pixels"
Posted: Sun Jan 23, 2022 12:21 am
by Samuele
allright, thanks, but my probllem is actually this
sorry, my bad I didn't specify that I meant an id of an image in a button.
Thanks!
Samuele.
Re: "opaque pixels"
Posted: Sun Jan 23, 2022 2:26 am
by stam
You can't do this as an image in a button; if you click a button, you click a button regardless if the image is there or not.
Instead you need to import the PNG image as control (FILE menu -> import as control -> image)
Then add a mouseUp handler to the image's script.
download an example stack here:
https://www.mediafire.com/file/nq7f5sdn ... e.zip/file
Re: "opaque pixels"
Posted: Sun Jan 23, 2022 2:20 pm
by Samuele
yes, but that will increase the size of the stack a lot (and then the app, and my stack is already large uselessly), because the images i import i use them more then once, that's why i made buttons with icons.
or is there a way to reduce the stack size?
thanks.
Re: "opaque pixels"
Posted: Sun Jan 23, 2022 3:03 pm
by Klaus
No need to import all of your images!
This will also work with referenced images and will not add much to the filesize of the stack!
Re: "opaque pixels"
Posted: Sun Jan 23, 2022 3:05 pm
by richmond62
Here's a stack which has an image on the first card (it has 4 cards)
and a
graphic object "rr" on cards 2, 3 & 4 with its
backGroundPattern set
to the image on card 1.
-
-
-
graphic objects WILL behave like the images they have as backGroundPatterns insofar as whether
mouseDown/Up clicks get a reaction out of transparent areas.