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
Contributor
Posts: 42
Registered: ‎08-30-2012
My Device: PlayBook
My Carrier: Aircel

problem with list customization in playbook air 2.0

hi everyone,

 

can any one explain how to customize the list using cell renderer class, i got a problem when i click list item it is erasing in list, means empty field will appears

 

thanks

Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: problem with list customization in playbook air 2.0

These two threads are among several that might help you:

 

http://supportforums.blackberry.com/t5/Adobe-AIR-Development/PB-2-0-Tutorial-on-custom-data-lists/m-...

 

http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Passing-Arguments-to-a-Custom-CellRende...

 

Also, doing a search on the forums for cell renderer threads will get you lots of reading material.

 

If you're still stuck after reviewing these, it will help folks diagnose the issue if you post your code and a detailed description of symptoms - it's highly recommended to use the code clipboard in the forum post editor, so that your

code will not render on the forums unformatted and full of unintended emoticon symbols.

New Developer
Posts: 61
Registered: ‎06-07-2011
My Device: Playbook
My Carrier: Employee

Re: problem with list customization in playbook air 2.0

I want to change the list selection color (up or down or both), can you tell me the how can I do that?

Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: problem with list customization in playbook air 2.0

New Developer
Posts: 61
Registered: ‎06-07-2011
My Device: Playbook
My Carrier: Employee

Re: problem with list customization in playbook air 2.0

Thanks for the information,

 

I created my custom skin for the list which extends AbstractCellRendererSkin and implementing ICellrender, and I am setting the down, up skins in initializeStates() method. Now my problem is after selecting list item up skin is drawing over the labels which I added to list item, how can I solve this problem?

Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: problem with list customization in playbook air 2.0

Can you post your code?

Highlighted
New Developer
Posts: 61
Registered: ‎06-07-2011
My Device: Playbook
My Carrier: Employee

Re: problem with list customization in playbook air 2.0

This is my code 

public class ListSkin extends AbstractCellRendererSkin implements ICellRenderer
	{
		
		private var _row:int;
		private var _column:int;
		private var _section:int;
		private var _index:int; 
		
		/**
		 * Skins
		 **/
		protected var _upSkin:Sprite;
		protected var _selectedSkin:Sprite;
		protected var _downSkin:Sprite;
		protected var _disabledSkin:Sprite;
		private var formula:Formula;
		private var calcName:Label;
		
		public function ListSkin()
		{
			super();
			
			calcName = GUIUtils.getLabel("", 10,20, 25);
		}
		
		public function get data():Object
		{
			return formula;
		}
		
		public function set data(data:Object):void
		{
			if(data ==null)
				return;
			formula = data as Formula;
			calcName.text = formula.name;
		}
		
		public function get index():int
		{
			return _index;
		}
		
		public function set index(value:int):void
		{
			_index = value;
		}
		
		public function get row():int
		{
			return _row;
		}
		
		public function set row(value:int):void
		{
			_row = value;
		}
		
		public function get column():int
		{
			return _column;
		}
		
		public function set column(value:int):void
		{
			_column = value;
		}
		
		public function get section():int
		{
			return _section;
		}
		
		public function set section(section:int):void
		{
			_section = section;
		}
		
		public function get isHeader():Boolean
		{
			return false;
		}
		
		override protected function initializeStates():void
		{
			var matrix:Matrix = new Matrix();
			matrix.createGradientBox(320,50,90/180*Math.PI);
			
			_upSkin = new Sprite();    
			
			_upSkin.graphics.clear();
			_upSkin.graphics.beginGradientFill(GradientType.LINEAR,[0x000000,0x000000, 0x000000],[0.1,0.1,0.1],[0,127,255],matrix);
			_upSkin.graphics.lineStyle(1,0xffffff);
			_upSkin.graphics.drawRoundRect(0,0,320,50,7,7);
			_upSkin.graphics.endFill();
			
			_downSkin = new Sprite();   
			
			_downSkin.graphics.clear();
			_downSkin.graphics.beginGradientFill(GradientType.LINEAR,[0xf68368,0xf15531,0xb52f10],[1,1,1],[0,127,255],matrix);
			_downSkin.graphics.lineStyle(1,0xffffff);
			_downSkin.graphics.drawRoundRect(0,0,320,50,7,7);
			_downSkin.graphics.endFill();
			
			// Set up the skin states
			
			setSkinState(SkinStates.UP,_upSkin);
			setSkinState(SkinStates.DOWN,_downSkin);
			setSkinState(SkinStates.DOWN_SELECTED,_downSkin);
			setSkinState(SkinStates.SELECTED,_downSkin);
			
			showSkin(_upSkin);
			
		}
		
		override protected function onAdded():void
		{
			super.onAdded();
			addChild(calcName);
		}
		
		override protected function onRemoved():void
		{
			super.onRemoved();
			removeChild(calcName);
		}
		
	}