I have an app Im building with that I want to have a toggleswitch control whether or not a function STOPS running or Whether it should RESTART.
how to I set this up? I've tried
if (toggleswitch1.thumbPosition = 0) {
trace("The function should STOP");
} else {
trace("The function should RESTART");
}
If you're using a ToggleSwitch ; you can just use the selected property to determine the state of the button.
if (toggleswitch1.selected == false) {
trace("The function should STOP");
} else {
trace("The function should RESTART");
}
Also, as a critique of your code; this line toggleswitch1.thumbPosition = 0
is an assignment and will always return true. If you want to check for equality be sure to use the double equal sign '==' instead of the single equal sign '='.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.