Skip navigation
Currently Being Moderated

combo box : an infinite loop

Apr 17, 2012 3:52 AM

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.

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 5:01 AM   in reply to Ron Colmen

    The code you show works fine.  There may be something else with your code that is causing the problem, like maybe the code you don't show... the stuff you show as "/// code continues..."

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points