3 Replies Latest reply on Jan 18, 2007 5:33 AM by Lair of the Raven

    ComboBox .TXT Importer

    Lair of the Raven
      Hey guys,

      I have a ComboBox and a TextArea.

      When the user selects an option from the ComboBox, the TextArea loads a .txt file from the root.
      The import of the .txt is not the problem here. That script works perfectly.

      The problem I am having is that the code is not reading the content of the ComboBox.

      I have a Trace line to display the content that it reads and evey time it is 'undefined'

      Could someone give me some guidance? Or if they have a code that works, it would be much appreciated.
        • 1. ComboBox .TXT Importer
          Lair of the Raven Level 1
          I have an alternate code, this tie using a button.

          It loads the first value in the IF statment, but then does not load anything else if changed. If I select the second option klit still refers to 2. Any ideas?

          Even more frustrating, is that it reads the value of the ComboBox perfectly. There must be something arwy with my if statement.
          • 2. Re: ComboBox .TXT Importer
            Marghoob Suleman Level 1
            Hi Turaga Nuju,

            >>myListener = myComboBox();

            it should be
            myListener = new Object();

            >>myListener.change = function(evt){

            >>num_crs = myComboBox.value()
            // should be
            num_crs = evt.target.value; // get selected value
            stext = evt.target.text; // get selected label/text
            trace(num_crs + " " + stext);

            >> thisText = new LoadVars();
            >> if (num_crs = "goat") {
            >> thisText.load("0.txt"); }
            >> else if (num_crs = "cheese") {
            >> thisText.load("1.txt"); }
            >>thisText.onLoad = function(success) {
            >> if (success) {
            >> TextHolder.text = thisText.myText;
            >> } } }
            >> myButton.addEventListener("change", myListener);

            myButton is you combobox instance name? if yes then okay... otherwise you need to change in your code or combobox name.