A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Using the ".selected" property of a checkBox?

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Location
    Leeds
    Posts
    19

    Using the ".selected" property of a checkBox?

    When trying to check if a checkBox has been checked can you use the checkBox.selected property and assign it to a variable in order to process it? Basically I want to control one movie depending on certain checkBoxes being checked?

    Thanks

    Neil

  2. #2
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    How about...

    if (yourCheckBox.selected == true){
    //do whatever
    }
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Location
    Leeds
    Posts
    19
    Tried that, but when I selected any other checkBox and executed this code the checkBox in the code became selected!? Thats why I wondered if there was a way of extracting this info to a variable, but I tried trace(checkBox.selected) and this didn't return a value.

  4. #4
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    You're right. I wasn't really thinking. How's this:
    Suppose I have two check boxes called check1 and check2. Then I have a dynamic text box called output.

    function checkChange(component) {
    if (component._name == "check1" && component.getValue() == true) {
    output = output + "Box 1 checked. ";
    } else if (component._name == "check2" && component.getValue() == true) {
    output = output + "Box 2 checked. ";
    }
    }
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  5. #5
    Junior Member
    Join Date
    Feb 2005
    Location
    Leeds
    Posts
    19
    Looks a little beyond me, but I will try on Monday. My way is a bit more long winded!

    Thanks

    N

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center