Skip to main content
Inspiring
August 20, 2006
Answered

If statements within component listener

  • August 20, 2006
  • 1 reply
  • 240 views
Hi,

I am going to use two radiobuttons and have a selection using if -statement. When i test this script both the trace -commands are executet. Can anyone please tell me what i am missing. I want only one of the if-statements to execute when clicking the radiobuttons.

The script i am testing.

flashistListener = new Object();
flashistListener.click = function (evt){
//slask = evt.target.selection.data;
//trace(slask);
if (rb_default.selected = true) {
trace(">>>value<<<");
}
if (rb_no_default.selected = true) {
trace(">>>novalue<<<");
}

}
radioGroup.addEventListener("click", flashistListener);
This topic has been closed for replies.
Correct answer Pe_ka
Thank you now it works.

1 reply

Inspiring
August 20, 2006
I am not sure about the rest of the code but I think the condition for the if statement should be:

if (rb_default.selected == true) {

and

if (rb_no_default.selected == true) {

if you are determinging if the rb_default.selected equals true then use "==" rather than "="


Pe_kaAuthorCorrect answer
Inspiring
August 20, 2006
Thank you now it works.
Inspiring
August 20, 2006
You're welcome.