mouseover event when using addImageObject

Is there any way to set a mouseover event for a g:image, if it is added using backgroundId.addImageObject


Answer this question

mouseover event when using addImageObject

  • Kamii47

    Unfortunately not, <g:background> doesn't support events. <g:image> does support events, but it will only be of use if you don't have a transparent background.

  • TomBB

    Sorry, I have proposed this solution previously, there's even some source code on here somewhere.

    You need to ensure that the region below the clickable area is partially opaque though, ~90% or less off the top of my head. If it's completely transparent the mouse events don't fire.

  • Bill Reiss

    Well I have made a workaround by using a completely transparent .png that overlays the bgid.images and mapping clickable areas to it.

    Kind of long-winded, but it works and I'm still able to display part-transparent images beneath it.

  • Batuhan

    It seems to be working fine so far. The only thing I have noticed, is the mouseout events don't always seem to trigger.

  • mouseover event when using addImageObject