So, I have a couple of flip switches that are set up like this:
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.
Trouble with switches
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Trouble with switches
Don't know what you mean because the screenshot is missing
Re: Trouble with switches
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
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Trouble with switches
@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: 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...
Re: Trouble with switches
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.
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.
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Trouble with switches
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.
Re: Trouble with switches
Got it! Thank you!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.