AW: best way to define clickable areas with irregular shapes ?

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri May 25 12:30:26 EDT 2007


Hi Tiemo,

You have many ways: it depends on the fact you have many hotspots  
close from each other or not.
For instance if your hotspots are able to be conformed in a virtual  
grid you can test the mouseLoc within this grid.
If it does not appear possible, adding invisible graphics should work.
You get the mouse events only on real hotspots using the png and a  
loop allows you to know how to act:
For instance:
In the script of the png image:

on mouseUp
   repeat with i = 1 to the number of graphics
     if the mouseloc is within the rect of graphic i then
       Action the short name of graphic i -- see below
       exit repeat
     end if
   end repeat
end mouseUp
----------------------------------
on Action pObjName
   switch pObjName
   case "bottle of wine"
etc.

;-)

Le 25 mai 07 à 16:40, Tiemo Hollmann TB a écrit :

> Hi Eric, because it's also interesting for me I add a question.  
> Assuming you
> have 50 hotspots on the bg image, where 50 different actions have  
> to take
> place (e.g. showing another image for each hotspot), how can you  
> address the
> different non transparent hotspots on the png? With 50 irregular  
> shapes,
> each with another name its no problem, but this way?
>
> JB, what was the problem with the irregular shapes for you?
>
> Thanks Tiemo
>
>> -----Ursprüngliche Nachricht-----
>> Von: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
>> bounces at lists.runrev.com] Im Auftrag von Eric Chatonet
>> Gesendet: Freitag, 25. Mai 2007 15:45
>> An: How to use Revolution
>> Betreff: Re: best way to define clickable areas with irregular  
>> shapes ?
>>
>> Hi JB,
>>
>> As png images with transparency (alpha channel) receive mouse
>> messages only in non transparent areas, here is a way to do the  
>> trick:
>> Open your original image in PhotoShop or any image editor you use and
>> erase all non hotspots places then save this modified image as a png.
>> Hotspots are now very precise :-)
>> Put both images onto a card, the modified one on top:
>> Now mousedowns, mouseUps, etc. will only bee sent when done in hot
>> spots.
>> If you have many hot spots, you can ensure the process by adding
>> rough invisible graphics including each hotspot and test in addition
>> in which graphic the mouse is within.
>> Note that you can set the blendlevel of the modified image to 100, it
>> will be invisible but all will go on to work :-)
>>
>> Le 25 mai 07 à 15:21, jbv a écrit :
>>
>>>
>>> What is the best way to define clickable maps / areas with irregular
>>> shapes
>>> on a large background image ?
>>> I've tried transparent graphics, and also a "mousemove" handler  
>>> in the
>>> card
>>> script, but nothing seems to work really well...
>>>
>>> thanks,
>>> JB
>>
>> Best regards from Paris,
>> Eric Chatonet.
>> ----------------------------------------------------------------
>> http://www.sosmartsoftware.com/
>> eric.chatonet at sosmartsoftware.com/
>> ----------------------------------------------------------------
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list