dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: ComboBox Changing Variables

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    400
    Friends,

    I'm trying to change some booleans from false to true using the ComboBox and I'm a wee-bit confused.

    FRAME 1

    Red = False
    Blue = False

    I would like a combobox with red and blue as the text but would like the booleans to be changed to true based on which color I select.

    Thoughts?

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    Hi, try this

    You need a comboBox called myCombo then just this code
    Code:
    red = false;
    blue = true;
    myCombo.addItem("Blue", "blue");
    myCombo.addItem("Red", "red");
    myCombo.setChangeHandler("checkCombo");
    function checkCombo(component) {
    	if(component.getValue() == "blue") {
    		blue = true;
    		red = false;
    	}else{
    		red = true;
    		blue = false;
    	}
    	trace("blue=" + blue + " and " + "red=" + red);
    }

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    400

    Nice, but . . .

    How would it be different if I were to use Check Boxes?

    Is "my.Combo" shown below the instance name or the Clip name?
    myCombo.addItem("Blue", "blue");

    Thanks.

  4. #4
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    Yes, myCombo is the Instance Name of your ComboBox. using checkboxes would be slightly different, but not majorly.
    But if you want a selection between two, radio buttons would be a better idea

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