If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Contributor
CanadianMike
Posts: 7
Registered: ‎02-25-2011
My Device: Not Specified

Using TilingBackground

Using TilingBackground seems to be poorly documented.  Here is the usage I found helpful.  I prefer this method as it avoids using a loader for the image.

 

 

package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	
	import qnx.ui.core.Container;
	import qnx.ui.core.Containment;
	import qnx.ui.display.TilingBackground;
	
	[SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
	
	public class TiledBackground extends Sprite
	{
		[Embed(source='./assets/background.png' )] private var APP_BACKGROUND :Class;
		
		private var tileBackground	: TilingBackground;
		private var cntBackground	: Container;
		
		public function TiledBackground()
		{
			super();

			tileBackground = new TilingBackground();
			tileBackground.containment = Containment.BACKGROUND;
			tileBackground.bitmapData = (new APP_BACKGROUND() as Bitmap).bitmapData;

			cntBackground = new Container();
			cntBackground.addChild(tileBackground);
			cntBackground.setSize(1024,600);
			
			this.addChild(cntBackground);
		}
	}
}

 

 

Thanks,

Mike

 

 

Please use plain text.
Contributor
mellisdesigns
Posts: 34
Registered: ‎03-23-2011
My Device: Blackberry Playbook
My Carrier: Not Avaliable

Re: Using TilingBackground

Mike


Will that automatically tile to fit the SWF size? Or are you grabbing the background.png and scaling to fit the SWF size?

 

best

Mitch Ellis

MELLISdesigns

Please use plain text.
New Contributor
CanadianMike
Posts: 7
Registered: ‎02-25-2011
My Device: Not Specified

Re: Using TilingBackground

Hi Mitch,

It tiles the PNG to fit the container, cntBackground.

Thanks,
Mike
Please use plain text.