1 Reply Latest reply on Jul 3, 2009 4:24 AM by stevoad

    Click event on a item renderer stops data being passed

    stevoad Level 1



      I'm trying to create a item renderer based on a Canvas, this renderer is then used in a List component. I'm trying to get a click event fired when the user clicks on one of the items in the List. I'm also formatting the data being passed into the item renderer to do this I'm overriding the set data property like this:


      override public function set data(value:Object):void


      title.text = value.marketName;

      sellPrice.text = value.sellPrice;

      buyPrice.text = value.buyPrice;

      change.text = value.percentageChangeOnDay;


      var i:String = "-";



      change.styleName = "PositiveChange";




      change.styleName = "NegativeChange";




      When I add a click event to my item renderer like this,


      <view:DisplayItem click="itemClickedEvent( event )" />


      I get a null reference error in my set data function. If I remove the click event the data is passed correctly, I've also found that if I use a rollOut event like this,


      <view:DisplayItem rollOut="rolledOverEvent( event )"/>


      the data is passed fine and the event works too, it seems that click events cause the data not to be passed.


      Why does having a click event cause this problem? How can I have a click event on the item renderer and still format my data?