How to replace or change image depending if switch is on or off?

Im on Axure RP 10. I am creating a smart home user interface and I want the icons/images of the devices to change based on if the switch below is on or off. For example a picture of a lamp with a switch underneath it, if switch is off lamp icon is just the lamp, if the switch is on then Axure should show a lamp that is on

I have both images for both instances, however when I use Set Image on a switch it adds it to both instances, “on” and “off”. Think it is because they are under the same dynamic panel?
Any help would be appreciated.

Hi @Vin00,

To have different interactions occur dependent on other statuses, conditional logic is the way to do so! You can use conditional logic to specify which interactions should occur under what cases. You can learn more about these if/then relationships by reading through our Axure Docs about Conditional Logic below:

For your example, there are several ways to achieve this result. Using the “Set Image” interaction combined with conditional logic, I was able to set an image widget to display based on the text on the button itself. Using dynamic panels, I was able to set the dynamic panel to a specific state based on the button. These two methods use conditional logic. Another way is to use dynamic panels each with its own set of widgets. This method does not need to use conditional logic but achieves the same result you are describing. I have also attached my sample .rp file illustrating these three ways. Hope that helps!

light switch.rp (81.6 KB)

Thank you. Perfect. Thank you for the example.