3 Replies Latest reply on Jan 28, 2011 5:30 PM by peteandrus

    CheckBox in an itemRenderer not catching currentStateChanged?


      i have an itemRenderer with a checkBox. it works great thanks in no small part to some of the people on this forum.


      However, more trouble has arisen! Here is the code:


      s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      autoDrawBackground="true" initialize="init()">
              <!-- Place non-visual elements (e.g., services, value objects) here -->
                  import mx.binding.utils.BindingUtils;
                  import mx.events.StateChangeEvent;
                  private var trueOrFalse:Boolean;
                  private function init():void
                  private function changeFontColor():void


                  protected function check_currentStateChangeHandler(event:StateChangeEvent):void
                      //do stuff


          <s:CheckBox id="check" currentStateChange="check_currentStateChangeHandler(event)" selected="{data.selected}"   click="changeFontColor()" label="{data.label}">



      originally i just had the 'changeFontColor" method assigned to the 'click' event, but then i added a checkBox (outside the list where i use these itemRenderers) that, when checked, changes the selected value of each checkBox in the List to its value (basically, if it's checked, then all rendered checkBoxes in the List do the same.. .and vice versa).


      anyways, since the selected field in 'check' is bound to the dataProvider's 'selected' field, shouldn't the 'currentStateChanged' event fire whenever i change the value of 'data.selected'?


      i do this currently, but no currentStateChanged event fires. I want the color of these itemRenderers to change whenever i hit the checkBox outside the List as well as when i click on them.