A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 49 of 49

Thread: ComboBoxes :(

  1. #41
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125
    Ah, the insane laughter of the overworked.... good luck, and holler if you need help!

  2. #42
    Senior Member
    Join Date
    May 2001
    Posts
    110
    Ok that worked but only if the person selects "select one" it does not see "select one" as a default value. Was that clear enough? I guess the variable isn't passed until the user selects one of the answers. If I drop the menu and select "select one" then it works. If I just leave it as is, it doesn't work.

  3. #43
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125
    Hmmm. Try getting rid of the "Select One:" since it's not defaulting to that anyway, and then replace
    Code:
    if (varComboBox1 == "Select One:") {
    with
    Code:
    if (varComboBox1 == "") {
    Maybe that will work.

  4. #44
    Senior Member
    Join Date
    May 2001
    Posts
    110
    nada tada I think it's because of the way my change handler is set up.
    Code:
    comboBox1.addEventListener ("change", comboBox1Change);
    function comboBox1Change() {
     varcomboBox1 = comboBox1.getValue();
     myLoadVars.varcomboBox1 = varcomboBox1;
    }

  5. #45
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125
    Where do you initially create the variable varComboBox1? Are you creating it in the change handler, or have you created it somewhere else and are referring to it in the change handler?

  6. #46
    Senior Member
    Join Date
    May 2001
    Posts
    110
    hmmmm I'm thinking it's in the change handler. Here is my complete code though. Sorry I can't tell you for sure, I'm still learning. Please disregard the mess, I've commented out alot of future things.

    Code:
    //Make ComboBoxes Invisible
    pBar._visible = false
    comboBox2._visible = false
    comboBox5._visible = false
    comboBox6._visible = false
    comboBox7._visible = false
    comboBox4_2._visible = false
    comboBox4_3._visible = false
    businessLayout._visible = false
    comboLabel2._visible = false
    
    //Makes component text blue
    _global.style.setStyle("color", 0x1948A2);
    
    //Adds "Change Handler" What to do when object is selected in ComboBox
    comboBox1.addEventListener ("change", myChangeHandler);
    comboBox2.addEventListener ("change", comboBox2Change);
    comboBox3.addEventListener ("change", comboBox3Change);
    comboBox4.addEventListener ("change", comboBox4Change);
    comboBox5.addEventListener ("change", comboBox5Change);
    comboBox6.addEventListener ("change", comboBox6Change);
    comboBox7.addEventListener ("change", comboBox7Change);
    go_Btn.addEventListener ("click", btnClick);
    est_Tree.addEventListener ("select", selectLink);
    
    //This is the variable that bundles all of the other variables
    myLoadVars = new LoadVars()
    
    //This is one of the "Change Handlers" mentioned above
    function myChangeHandler() {
    varcomboBox1 = comboBox1.getValue();
    myLoadVars.varcomboBox1 = varcomboBox1;
    if(varcomboBox1 == "0") {
    	//comboBox2._visible = false;
    	comboLabel2._visible = false;
    	comboBox5._visible = false;
    	comboBox6._visible = false;
    	comboBox7._visible = false;
    	businessLayout._visible = false;
    }else if(varcomboBox1 == "1.1") {
    	comboBox2._visible = false;
    	comboLabel2._visible = false;
    	comboBox5._visible = false;
    	comboBox6._visible = false;
    	comboBox7._visible = false;
    	businessLayout._visible = false;
    }else if(varcomboBox1 == "1.2") {
    	comboBox2._visible = false;
    	comboLabel2._visible = false;
    	comboBox5._visible = true;
    	comboBox6._visible = true;
    	comboBox7._visible = true;
    	businessLayout._visible = true;
    }else if(varcomboBox1 == "1.3") {
    	comboBox2._visible = true;
    	comboLabel2._visible = true;
    	comboBox5._visible = true;
    	comboBox6._visible = true;
    	comboBox7._visible = true;
    	businessLayout._visible = true;
    }
    }
    
    //"Change Handler"
    function comboBox2Change() {
    varcomboBox2 = comboBox2.getValue();
    myLoadVars.varcomboBox2 = varcomboBox2;
    }
    
    //"Change Handler"
    function comboBox3Change() {
    varcomboBox3 = comboBox3.getValue();
    myLoadVars.varcomboBox3 = varcomboBox3;
    if(varcomboBox3 == "0") {
    	comboBox4_2._visible = false;
    	comboBox4_3._visible = false;
    }else if(varcomboBox3 == "3.1") {
    	comboBox4_1._visible = true;
    	comboBox4_2._visible = false;
    	comboBox4_3._visible = false;
    }else if(varcomboBox3 == "3.2") {
    	comboBox4_1._visible = false;
    	comboBox4_2._visible = true;
    	comboBox4_3._visible = false;
    }else if(varcomboBox3 == "3.3") {
    	comboBox4_1._visible = false;
    	comboBox4_2._visible = false;
    	comboBox4_3._visible = true;
    }
    }
    
    //"Change Handler"
    function comboBox4Change() {
     varcomboBox4 = comboBox4.getValue();
     myLoadVars.varcomboBox4 = varcomboBox4;
    }
    
    //"Change Handler"
    function comboBox5Change() {
     varcomboBox5 = comboBox5.getValue();
     myLoadVars.varcomboBox5 = varcomboBox5;
    }
    
    //"Change Handler"
    function comboBox6Change() {
     varcomboBox6 = comboBox6.getValue();
     myLoadVars.varcomboBox6 = varcomboBox6;
    }
    
    //"Change Handler"
    function comboBox7Change() {
     varcomboBox7 = comboBox7.getValue();
     myLoadVars.varcomboBox7 = varcomboBox7;
    }
    //function selectLink() {
    	
    //"Change Handler"
    function btnClick() {
    	if(comboBox1._visible == true && varcomboBox1 == "") {
    	comboBox2._visible = true;
    }
    }
    //import mx.controls.Alert
    //Alert.cancelLabel = "Back"
    //myClickHandler = function (evt){
    //}
    //Alert.show("Answer all questions.", "CreditSoft", Alert.CANCEL, this, myClickHandler, "alertIcon", Alert.CANCEL);
    //pBar._visible = true;
    //pBar.source = est_Tree;
    //if (myComboBox2._visible == true) {   
     //if (varComboBox2 == "Select One:") {  //User hasn't selected anything
      //Some code showing user a message saying they have to select.
     //}
    //}
    //And so on for each of the combo boxes.
    //Code that really submits goes here. The user will only get to this point if they've selected everything they're supposed to.
    
    
    //est_TreeDP = new XML();
    //est_TreeDP.ignoreWhite = true;
    //est_TreeDP.load("http://10.0.0.251/FlashXml.aspx?test=1.1?"+myLoadVars);
    //est_TreeDP.onLoad = function(){ 
    //est_Tree.dataProvider = est_TreeDP;
    //		}
    //est_Tree.setIcon(myTree.getTreeNodeAt(1), "pdfIcon");
    //}
    
    
    stop();
    Sorry if that is confusing I can try and sort it out for you.

  7. #47
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125
    I'm guessing that because the variables varcomboBox1, varcomboBox2, etc., are created in the change handler functions, they're not available elsewhere. It's a mistake I've made before. So humor me, and try putting these lines at the beginning of your code:
    Code:
    var varcomboBox1 = "";
    var varcomboBox2 = "";
    //And so on for all of them.
    I'm hoping that this will make
    Code:
    if (varComboBox1 == "") {
    work properly. If not, well, back to the drawing board...

  8. #48
    Senior Member
    Join Date
    May 2001
    Posts
    110
    Got it!
    I put the code in the change handler and outside so it would pick up the intital variable. Thanks!

  9. #49
    Senior Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    125
    Great!

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