transparency in image vs button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
transparency in image vs button
I have mouseUp handlers assigned to images, but I notice that the transparent icons in the images aren't treated the same way is in buttons. In buttons, the whole area including transparent and alphatransparent registers mouseUp events. It appears that on images this is not the case, and only opaque pixels will register a mouseUp event. Is there a way to make the transparent pixels on the images also respond to mouseUp?
Re: transparency in image vs button
Hi Steve,
Nope, best to set their transparency to 1%... maybe 5%.
If you don't have the original image you can try adding a layer @ 1 % and then saving it as a png.
Simon
Nope, best to set their transparency to 1%... maybe 5%.
If you don't have the original image you can try adding a layer @ 1 % and then saving it as a png.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: transparency in image vs button
Hi Steve,
in most cases the best way to display images which needs interactions with the user is to display them in buttons
Where "myImage" is any name of an image that you have in a card of a stack or substack.
Another solution could be to put a button with opaque set to false over the image, but in this case you need more effort to move them together if you need to.
in most cases the best way to display images which needs interactions with the user is to display them in buttons
Code: Select all
set the icon of button "myButton" to "myImage"
Another solution could be to put a button with opaque set to false over the image, but in this case you need more effort to move them together if you need to.
Re: transparency in image vs button
Steve,
while Mag's suggestion to use a button is usually the way to go here is a little script that sets the alphaData (the data for transparency) just from 0 (completely transparent) to 1 (hardly noticeble less transparent).
Sometimes one wants to stick to image nonetheless.
This only applies to images with transparent areas, usually png.
Transparent parts of your image will now get the mouse events.
Kind regards
Bernd
while Mag's suggestion to use a button is usually the way to go here is a little script that sets the alphaData (the data for transparency) just from 0 (completely transparent) to 1 (hardly noticeble less transparent).
Sometimes one wants to stick to image nonetheless.
This only applies to images with transparent areas, usually png.
Transparent parts of your image will now get the mouse events.
Code: Select all
on mouseUp
put the alphaData of image "myImage" into tData
put the length of tData into tHowOften
put numToChar(0) into tTrans -- transparent
put numToChar(1) into tAlmostTrans -- almost transparent
repeat with i = 1 to tHowOften
if char i of tData = tTrans then put tAlmostTrans into char i of tData
end repeat
set the alphaData of image "myImage" to tData
end mouseUp
Bernd
Re: transparency in image vs button
Nice one Bernd!
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: transparency in image vs button
Thanks Simon,
though one caveat:
If you apply this script to a referenced image (an image the has its fileName set and thus points to a file) then the image will loose the filename and is not longer a referenced image but a local image.
If you want to apply this change to a referenced image and you want to make that change permanent in the file you would have to export that image. After export the image in the file keeps the alpha-channel setting.
Kind regards
Bernd
though one caveat:
If you apply this script to a referenced image (an image the has its fileName set and thus points to a file) then the image will loose the filename and is not longer a referenced image but a local image.
If you want to apply this change to a referenced image and you want to make that change permanent in the file you would have to export that image. After export the image in the file keeps the alpha-channel setting.
Kind regards
Bernd
Re: transparency in image vs button
This old thread may also prove worthwhile to examine
http://forums.runrev.com/phpBB2/viewtop ... 938#p38938
http://forums.runrev.com/phpBB2/viewtop ... 938#p38938
Re: transparency in image vs button
Hi
I am searching an opposite solution :
I have a map of France with 95 regions in it.
I want the user be able to select 1 region to get information on it.
If it is images, it works fine : the transparent part of the image is not selected by the rollover or the mouseUp event.
But if I want to change the color of the region on rollover or on mouseUp, I can not change the image because it is in a group and the group is not a background. Then, I have tried the color overlay functions, it works but it is far too slow !
I have tried to put these 95 regions in 95 buttons, but when buttons have transparent background that overlap, it does not work at all as 1 region can be highlighted when another is selected...
I think the best way would be to change dynamically the image of the selected region, but I can not go through that : as the 95 regions are grouped all together.
If anyone has an idea, thanks in advance.
I am searching an opposite solution :
I have a map of France with 95 regions in it.
I want the user be able to select 1 region to get information on it.
If it is images, it works fine : the transparent part of the image is not selected by the rollover or the mouseUp event.
But if I want to change the color of the region on rollover or on mouseUp, I can not change the image because it is in a group and the group is not a background. Then, I have tried the color overlay functions, it works but it is far too slow !
I have tried to put these 95 regions in 95 buttons, but when buttons have transparent background that overlap, it does not work at all as 1 region can be highlighted when another is selected...
I think the best way would be to change dynamically the image of the selected region, but I can not go through that : as the 95 regions are grouped all together.
If anyone has an idea, thanks in advance.
Re: transparency in image vs button
You aren't going to want buttons considering the overlap of rect transparency. You need 95 images on top of each other, not 95 buttons, and embed inside the script of each image object the mouseUp event and actions per image. The grouping of the images should make no difference.
Re: transparency in image vs button
Thanks.
I do not want to make one script per image, it is too tricky to manage.
I use mouseUp, Down, Leave, Enter, Move on the group with "the target".
I still can not modify images inside the group. I am almost sure there is something to do with the background as it is in the error msg (can not find the background).
I do not want to make one script per image, it is too tricky to manage.
I use mouseUp, Down, Leave, Enter, Move on the group with "the target".
I still can not modify images inside the group. I am almost sure there is something to do with the background as it is in the error msg (can not find the background).
Re: transparency in image vs button
Hi fpierron,
95 images sounds like a good time to build yourself an LC tool.
What I mean is that you use LC to do the hard/repetitive work for you.
Lookup "script" in the dictionary.
Now hopefully your images have sequential names, it would make this easy:
You could refer to them by just their number:
Yes that should do it, their numbering is in their layer e.g. img 1 is below img 2 etc.
I'm attaching a sample LC tool that I made to change normal text into LC strings. You probably use it to convert the mouseEnter etc into a string for that set the script.
I'm probably not making myself too clear
Write back with questions.
Oh, the attached tool is an external stack but it could all be written into a button that you delete when you are done.
Simon
95 images sounds like a good time to build yourself an LC tool.
What I mean is that you use LC to do the hard/repetitive work for you.
Lookup "script" in the dictionary.
Now hopefully your images have sequential names, it would make this easy:
Code: Select all
repeat with i = 1 to 95
set the script of img "Provence" & i to "on mouseEnter...
Code: Select all
repeat with i = 1 to 95
set the script of img i to "on mouseEnter...
I'm attaching a sample LC tool that I made to change normal text into LC strings. You probably use it to convert the mouseEnter etc into a string for that set the script.
I'm probably not making myself too clear

Write back with questions.
Oh, the attached tool is an external stack but it could all be written into a button that you delete when you are done.
Simon
- Attachments
-
- infamous_quotes.zip
- LC 6.0
- (838 Bytes) Downloaded 380 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!