Button state image swap in code


(sam woolf) #1

Hi there,

I am using hype buttons with a ‘normal’ and ‘pressed’ state as a play button. I would like to be able to swap the images for both states in code, so that when my audio file is playing, the play button images are replaced with pause button images. Is there a way to change the images for specific states for a hype button in code?

thanks!


(Jonathan Deutsch) #2

Not using button states. Instead you’ll want to fashion your own buttons with On Mouse Down/On Mouse Up actions and have that invoke javascript to change the background via a call like:

hypeDocument.setElementProperty(element, "background-image", "${resourcesFolderName}/otherImage.png");