1 Reply Latest reply on Apr 27, 2006 4:33 PM by blemmo

    Help on Combobox change handler

    animee
      Hi,
      I've got the following problem.

      I have a combobox and a textfield on stage and want to format selected text in the field via the combobox (bold, italic, underline).
      My actions:

      styleListener = new Object();
      styleListener.change = function() {
      Selection.setFocus(source_txt);
      Selection.setSelection(begin, end);
      myTextFormat = currentFormat;
      myTextFormat.bold = true;
      source_txt.setTextFormat(begin, end, myTextFormat);
      refreshText();
      gotoAndStop(1);
      };
      styleList.addEventListener("change", styleListener);

      When i run the movie and change my combobox teh output says that i've reached the 256 loops limit and no more actions will be executed.

      I've no idea what to do so please, anybody help me?
        • 1. Re: Help on Combobox change handler
          blemmo Level 1
          I bet it's the refreshText() function that causes this. If you do something in the refreshText() function that triggers the change event again, it will call refreshText, which triggers change... started an endless loop. Check if the change event gets triggered through the actions in refreshText, or the gotoAndStop(1), and find a workaround to this, maybe by using a temporary variable that blocks the event.

          hth,
          blemmo