1 Reply Latest reply on Mar 2, 2007 4:14 PM by tspratt

    button in datagrid cell not firing click event

    Diemos Level 1
      I have a datagrid with a custom button renderer built in Actionscript. I'm trying to figure out how to capture the click event of the component when the button is clicked.

      I'm generating the component from the cell depending on the type of field:
      column.itemRenderer = new ClassFactory(DpFileRenderer);

      The actual component:

      package joe.ui {
      import mx.controls.Button;
      import flash.events.MouseEvent;
      import flash.events.Event;

      public class DpFileRenderer extends Button
      {
      [Embed("/assets/icons/drive_disk.png")]
      private var diskIcon:Class;
      [Embed("/assets/icons/drive_disk_grey.png")]
      private var diskIconDisabled:Class;

      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
      {
      super.updateDisplayList(unscaledWidth, unscaledHeight);
      this.label = this.listData.label;
      if(this.listData.label != '0')
      {
      this.setStyle("icon", diskIcon);
      } else {
      this.setStyle("icon", diskIconDisabled);
      this.enabled = false;
      }
      this.labelPlacement = "left";
      this.setStyle("color", 0x000000);
      }
      }
      }

      I'm not exactly sure on where to put an event broadcast in there.

      Could anybody help?

      thanks.