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
Posts: 133
Registered: ‎12-02-2010
My Device: Z10 & Dev Alpha C
My Carrier: T
Accepted Solution

How do you override skins in bb10?

I am not able to override skins in BB10 Air 2.0 Beta

I am following this example from the documentation which does not work! https://developer.blackberry.com/air/beta/apis/qnx/fuse/ui/skins/package-detail.html

I used to be able to override the initializeStates method, however, with qnx.fuse.ui.skins.UISkin there is no such method as "initializeStates"

 

This is a snipet of code that used to work with the Playbook Air SDK

override protected function initializeStates():void 
		{

		upSkin = new Sprite();
		upSkin.graphics.beginFill(0xFF6600);
		upSkin.graphics.drawRect(0,0,200,200);
		upSkin.graphics.endFill();


Can some one provide me with an example for the BB10 Air 2.0 Beta SDK??

Thanks!

 

---------------------------------------------------------------------
Developer of Stocks for Blackberry 10
Developer
Posts: 133
Registered: ‎12-02-2010
My Device: Z10 & Dev Alpha C
My Carrier: T

Re: How do you override skins in bb10?

The documentation was just updated! I guess some one saw my post Smiley Happy
Well this now how you do it:

 

override protected function getSkinForState(state : String) : DisplayObject
{
	var asset : DisplayObject;
	
	switch (state)
	{
		case SkinStates.UP:
			if( upSkin == null )
			{
				upSkin = new Sprite();
				upSkin.graphics.beginFill(0xFF6600);
				upSkin.graphics.drawRect(0,0,200,200);
				upSkin.graphics.endFill();
			}
			asset = upSkin;
			break;
		case SkinStates.DOWN:
		case SkinStates.DOWN_SELECTED:
		case SkinStates.SELECTED:
			if( downSkin == null )
			{
				downSkin = new Sprite();
				downSkin.graphics.beginFill(0x333333);
				downSkin.graphics.drawRect(0,0,200,200);
				downSkin.graphics.endFill();
			}
			asset = downSkin;
			break;
		case SkinStates.DISABLED:
		case SkinStates.DISABLED_SELECTED:
			if( disabledSkin == null )
			{
				disabledSkin = new Sprite();
				disabledSkin.graphics.beginFill(0xCC0000);
				disabledSkin.graphics.drawRect(0,0,200,200);
				disabledSkin.graphics.endFill();
			}
			asset = disabledSkin;
			break;
	}
	return asset;
}

 

---------------------------------------------------------------------
Developer of Stocks for Blackberry 10
Highlighted
Retired
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook
My Carrier: Bell

Re: How do you override skins in bb10?

Yes - I let the documenation team know. I guess they just updated it without letting me know.

 

Glad to see that you got what you were looking for Smiley Happy

 

Cheers,

Dustin

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/