Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
eugenevk
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000

CustomCellRenderer with image; which row clicked?

I have defined the below custom CellRenderer. It displays a trash can icon at the right side of the label of a list. How can I find out of which row the icon has been 'clicked'?

 

package
{
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import qnx.ui.display.Image;
	import qnx.ui.listClasses.AlternatingCellRenderer;

	public class MyCellRenderer extends AlternatingCellRenderer
	{
		private var _imgDelete:Image = new Image();
		
		public function MyCellRenderer ()
		{
			super();        
		}

		override protected function init() : void
		{
			super.init();
			
			with (_imgDelete)
			{
				setImage('images/Delete.png');
				x = 950;
				y = 5;
				addEventListener(MouseEvent.CLICK, onDeleteClicked);
			}
			
			this.addChild(_imgDelete);
		}
		
		private function onDeleteClicked (event:MouseEvent) : void
		{
			dispatchEvent(new Event(Event.SELECT, true));
		}
	}
}

 

 

Eugene

My PlayBook App: Checklists
Please use plain text.
Developer
eugenevk
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000

Re: CustomCellRenderer with image; which row clicked?

Found it myself. I can use event.target.index in the main code.

Eugene

My PlayBook App: Checklists
Please use plain text.