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: 10
Registered: ‎01-25-2011
My Device: Not Specified

TileList CellRenderer has white background

Hi all,

 

I'm having a pretty infuriating problem with a TileList component I'm implementing.  I have a custom CellRenderer set up that is supposed to display an image and some text, but when I run the app there is a white background in each cell that takes up part of the cell.  If I click and hold over the area it turns blue, so I thought that perhaps it's related to the selectionmode of the TileList, but even if I set 

scroller.selectionMode = ListSelectionMode.NONE;

 I still get the unsightly white background.

 

 

The scroller implementation looks like this:

 

scroller = new TileList(); 
scroller.selectionMode = ListSelectionMode.NONE;
scroller.x=465;
scroller.y=58;
scroller.columnCount=1;
scroller.scrollDirection=ScrollDirection.VERTICAL;
scroller.cellPadding=0;
scroller.rowHeight = 235;
scroller.setSkin(com.components.rRenderer);
scroller.dataProvider=new DataProvider(data as Array);
addChild(scroller);
scroller.setSize(592,544);

 

 

 

And the cell renderer looks something like this:

 

public class rRenderer extends CellRenderer
	{
		var rowR:RowRendererSml = new RowRendererSml();		
		
		public function rRenderer()
		{
			super();
		}
		
		override public function set data(data:Object):void{
			super.data=data;
			if(data){
				rowR.txtCat.text=data.category;
				rowR.thumbnail1.loadImage(data.payload[0].icon1 as String);
				
				rowR.txtCat.addEventListener(MouseEvent.CLICK,handleClick);
			}
		}
		
		private function handleClick(ev:MouseEvent):void{
			dispatchEvent(new CustomEvent(CustomEvent.CUSTOM_ACTION,data,true));
		}
		
		override protected function onAdded():void{
			super.onAdded();
			addChild(rowR);
		}
		
		override protected function onRemoved():void{
			super.onRemoved();
			removeChild(rowR);
		}
	}

 I have no idea where the white background is coming from... please help?

 

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: TileList CellRenderer has white background

Is it still white when setSkin is commented out?

Contributor
Posts: 10
Registered: ‎01-25-2011
My Device: Not Specified

Re: TileList CellRenderer has white background

Yes, it is still white if setSkin is commented out.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: TileList CellRenderer has white background

So its not your renderer.  What exactly is white?  Just the scroller or the entire screen?  What color is the background of your root sprite?  Can you post a screen shot?

Highlighted
Contributor
Posts: 10
Registered: ‎01-25-2011
My Device: Not Specified

Re: TileList CellRenderer has white background

 

Here's a screenshot.  The cellrenderer starts just above the "test1" label

Contributor
Posts: 10
Registered: ‎01-25-2011
My Device: Not Specified

Re: TileList CellRenderer has white background

I hope someone can help me on this one, it's extremely frustrating.  

 

I've figured out that the white background is somehow related to the columnWidth and rowHeight properties of the TileList. If I don't set one of these the white background defaults to about 40px or so, and grows in relation to the set values of columnWidth and rowHeight.

 

I've tried setting the TileList opaqueBackground specifically to null (even though that is its default value) all to no luck.  

 

Does anyone have any idea what could be causing this?

Contributor
Posts: 10
Registered: ‎01-25-2011
My Device: Not Specified

Re: TileList CellRenderer has white background

For anyone experiencing this issue, I managed to fix it (sort of) by setting the columnWidth and rowHeight to zero, and then setting the cellPadding to some number that's large enough to allow the cellRenderers not to overlap.  This is obviously a hack way of doing it, but it at least gets rid of the background.

 

NEW PROBLEM:

The topmost (or leftmost, depending on scroll direction) item disappears before it's fully out of the visible viewport of the TileList. 

 

New Contributor
Posts: 9
Registered: ‎03-13-2011
My Device: none
My Carrier: none

Re: TileList CellRenderer has white background

@cyangreen, I just found another workaround that is probably more suitable than setting height and width to 0 (which might cause additional problems later on).

 

In my custom CellRenderer's data setter function, I set the visibility of the skin to false. Looks like there is a default skin associated with the CellRenderer, so with your code, that skin will still be applied to each Tile.

 

Here's the bit of code that got rid of the white squares for me (without messing with height and width):

 

 

override public function set data(data:Object):void{
	super.data = data;
	
	// Set the default skin to be invisible. This is a bit
	// easier than creating a new skin, if your goal is
	// to hide the white background.
	this.skin.visible = false;
}