2 Replies Latest reply: Apr 17, 2012 10:34 AM by Ron Colmen RSS

    combo box : an infinite loop

    Ron Colmen

      Below is my code. without the combo box it works wel. But when I tried to assign ORIGINAL CODE (as below) to a combo box using COMBO CODE (as below) it does what it's suppoded to do but the combo box drop down menu stays on and everything freezes. I'm sure I'm not using the combo box correctly here. How can I fix this? I have also shown

       

      I've assigned the LABLES and the DATA using the components inspector.

       

      ORIGINAL CODE

      if (fav_tm0.value=="Orange"){

      ///code continues...

      }

      else if (fav_tm0.value=="Mango"){

      ///code continues...

      }

      else if (fav_tm0.value=="Apple"){

      ///code continues...

      }

       

       

      COMBO CODE:

      var cbListener:Object = new Object();

      fav_tm0.addEventListener("change", cbListener);

      cbListener.change = function () {

      ///

      }

       

       

      FINAL CODE:

      var cbListener:Object = new Object();

      fav_tm0.addEventListener("change", cbListener);

      cbListener.change = function () {

          if (fav_tm0.value=="Orange"){

      ///code continues...

      }

      else if (fav_tm0.value=="Mango"){

      ///code continues...

      }

      else if (fav_tm0.value=="Apple"){

      ///code continues...

      }

      }

       

      OUTPUT SHOWS

      256 levels of recursion were exceeded in one action list.

      This is probably an infinite loop.

      Further execution of actions has been disabled in this movie.