Skip to main content
BrianStapleton
Known Participant
December 7, 2009
Answered

CheckBox Component

  • December 7, 2009
  • 1 reply
  • 574 views

Hi all,

My CheckBox component (instance name: "chkSubscribe") is not returning a correct value when I use the trace function. This is the actionscript I'm using:

if (chkSubscribe.getValue()) {
            myData.WishtoReceive = "yes";
        } else {
            myData.WishtoReceive = "no";
        }

The check box is set to true but, no matter whether the box is clicked on or off, the trace function always returns the "yes" value.

Any idea where I'm going wrong?

This topic has been closed for replies.
Correct answer Ned Murphy

Since a CheckBox only has two states, and one property to reflect that, maybe you should just use that...

if(chkSubscribe.selected){

     etc...

1 reply

Ned Murphy
Legend
December 7, 2009

I don't see a trace call and I'm not aware of a getValue() method associated with the CheckBox component.  What do you get if you try tracing chkSubscribe.getValue() ?

BrianStapleton
Known Participant
December 7, 2009

Hi Ned, thanks for the reply.

I just tried your script and the trace result was "undefined"

This is what I had been using:

trace("Newsletter: " + myData.WishtoReceive);

Ned Murphy
Ned MurphyCorrect answer
Legend
December 7, 2009

Since a CheckBox only has two states, and one property to reflect that, maybe you should just use that...

if(chkSubscribe.selected){

     etc...