Trouble with switches

Anything related to Hollywood Designer goes in here
Post Reply
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

Trouble with switches

Post by ocean77 »

So, I have a couple of flip switches that are set up like this:

Image

On mouseclicking the buttons I want them to flip 'on' and add their respective values to a variable, and also subtract their values when flipped 'off'.
I was thinking I could use the same button image for both the 'on' and 'off' positions, but I'm too dumb to figure out how apparently.
Doesn't seem to be possible to have two conditions on the same event. Is that correct?

Also, how does the "Skip Events" thing work?

Thanks. :)
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Trouble with switches

Post by airsoftsoftwair »

Don't know what you mean because the screenshot is missing :)
User avatar
jPV
Posts: 600
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Trouble with switches

Post by jPV »

The image link seems to be a dropbox link and doesn't show as embedded then. Here's the URL to it for easier viewing: https://www.dropbox.com/s/o7u3nrv827c6r ... 6.png?dl=0
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Trouble with switches

Post by airsoftsoftwair »

@jPV: Thanks.

@ocean77: You don't need to use "Skip events" for what you want to do. Just add the non-selected and selected switch images to the page at the very same position. Make the selected switch image invisible. Then, add the following events to the non-selected image for "On mouse up":

1) Hide object: non-selected switch image
2) Show object: selected switch image

Now when the user clicks the image, the non-selected switch will be hidden and the selected one will be shown which will create the effect of activating the switch.

Alternatively, you could also import the two switch images into an animation object and then show frame 2 (= switch on) when the mouse button is down and frame 1 (= switch off) when it is up...

There are lots of ways to do what you want...
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

Re: Trouble with switches

Post by ocean77 »

Ok.

I guess what I was asking is if there was a possible visual way to add an else-if statement to the same graphic element, so I wouldn't have to have two.
Probably best to use code for these type of instances anyway(?)

Thanks.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Trouble with switches

Post by airsoftsoftwair »

Do you mean that you only want to use one object for the switch instead of two? That is possible by creating the switch as an animation object with the first frame being the off switch and the second frame the on switch... or vice versa.
ocean77
Posts: 111
Joined: Mon Jan 28, 2019 8:34 pm

Re: Trouble with switches

Post by ocean77 »

airsoftsoftwair wrote: Mon Aug 17, 2020 4:51 pm Do you mean that you only want to use one object for the switch instead of two? That is possible by creating the switch as an animation object with the first frame being the off switch and the second frame the on switch... or vice versa.
Got it! Thank you!
Post Reply