If condition without getting the else to function

:hugegrin: Hi,

Im using the following to display feedback once a check answer button is clicked to see if the correct object out of four has been selected.

It works as far as displaying the tick - once the correct object is selected but im unable to get the cross to display when the wrong choice is made (ie any other object than the correct one).

Would really be greatful if someone could help me out…


on (release) {

if (_root.choose1._visible == false) {
if (_root.choose2._visible == true) {
if (_root.choose3._visible == false) {
if (_root.choose4._visible == false) {

_root.tick._visible = true;

} else if (_root.choose2._visible == false)	{					

_root.cross._visible = true;

			}
		}
	}
}	

}


Cheers,

Clest

Would this work??

on (release) {

if (_root.choose1._visible == false) {
_root.tick._visible = true;
} else if (_root.choose2._visible == true) {
_root.tick._visible = true;
} else if (_root.choose3._visible == false) {
_root.tick._visible = true;
} else if (_root.choose4._visible == false) {
_root.tick._visible = true;

} else if (_root.choose2._visible == false) {
_root.cross._visible = true;
}

Gave it a go but the tick was displayed for everyone I selected. I think the problem is that 2 needs to be selected exclusivly for it to give correct feedback.

Will play with the idea you suggested though… thanks for your help

on (release) {

if (_root.choose2._visible == false) {
_root.cross._visible = true;
} else if (_root.choose2._visible == true) {
_root.tick._visible = true;
}
}

This worked but not exclusivly… ie with both choose2 (correct) & choose3 (incorrect) selected it still displayed the tick :upset:

Any help appreciated :p:

I’m not really understanding what you’re trying to do. My last suggestion was kinda a shot in the dark. If you can post your .fla file, I bet we’ll get 'er figured out in no time.

That would be great… also what would be the best way to reset it??? :beam:

put this on your check button


on (release) {
	if (_root.choose2._visible && !_root.choose1._visible && !_root.choose3._visible && !_root.choose4._visible) {
		_root.tick._visible = true;
		_root.cross._visible = false;
	} else {
		_root.tick._visible = false;
		_root.cross._visible = true;
	}
}

Like a dream!!! Thank you very much… may be pushing my luck here but was hoping you could let me know what code would go in a button to reset it???

:hugegrin:

If resetting means putting all to invisible… then… here you go :slight_smile:


on(release) {
         for (i=1;i<=4;i++){
               _root["choose"+i]._visible = false;
         }
             _root.tick._visible = false;
	_root.cross._visible = false;
}

Yep setting everything to its original state is what I needed to do… your solution is superb!

Out of curiosity though is that the easiest way?? I assumed that Flash would have some built in refresh/reset function that would be universal……. (kinda the equivalent of jumping to a new scene & jumping back…

Anyhow again thank you’ve been a great help ‘n’ have a great weekend :p:

Clest