Skip to main content
Inspiring
Aug 20, 2006 7:29 PM UTC
Answered

If statements within component listener

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 is closed to new replies. Start a new post to keep the conversation going.
Pe_kaCorrect answer
Inspiring
Aug 20, 2006 8:10 PM UTC
Thank you now it works.

3 replies

Inspiring
Aug 20, 2006 7:36 PM UTC
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 "="


Translate
Pe_kaAuthorCorrect answer
Inspiring
Aug 20, 2006 8:10 PM UTC
Thank you now it works.
Translate
Inspiring
Aug 20, 2006 11:16 PM UTC
You're welcome.
Translate