02-12-2013 02:39 PM
Hi, How can i change background color of LabelButton in Flex?
02-13-2013 02:23 AM
To change Label background you need to setskin of labelButton
package
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import qnx.fuse.ui.skins.SkinAssets;
import qnx.fuse.ui.skins.SkinStates;
import qnx.fuse.ui.skins.UISkin;
import qnx.fuse.ui.skins.text.TextInputSkin;
public class CustomTextSkin extends TextInputSkin
{
/**@private**/
protected var upSkin:Sprite;
/**@private**/
protected var disabledSkin:Sprite;
/**@private**/
protected var downSkin:Sprite;
/**
*Create a custom button skin
*/
public function CustomTextSkin()
{
super( );
}
override protected function getSkinForState(state : String) : DisplayObject
{
var asset : DisplayObject;
switch (state)
{
case SkinStates.UP:
if( upSkin == null )
{
upSkin = new Sprite() ;
upSkin.graphics.beginFill(0xFFFFFF , 0.0 ) ;
upSkin.graphics.drawRect(0 , 0 , 600 , 86 ) ;
}
asset = upSkin;
break;
case SkinStates.DOWN:
if( downSkin == null )
{
downSkin = new Sprite() ;
downSkin.graphics.beginFill(0xFFFFFF , 0.0 ) ;
downSkin.graphics.drawRect(0 , 0 , 600 , 86 ) ;
}
asset = downSkin ;
case SkinStates.DOWN_SELECTED:
case SkinStates.SELECTED:
if( downSkin == null )
{
downSkin = new Sprite() ;
downSkin.graphics.beginFill(0xFFFFFF , 0.0 ) ;
downSkin.graphics.drawRect(0 , 0 , 600 , 86 ) ;
}
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;
}
}
}
Save above code as CustomTextSkin.as in your Project by creating ActionScript class.
to set it as Your Labelbutton.. Use..
<LabelButton Object>.setSkin(CustomTextSkin) ;
02-13-2013 02:25 AM
02-13-2013 06:51 AM
I need to change the background color of LabelButton. opequeBackground not changing the full background.. it still showing the default back color around the Label inside the Button. How to change that color.
02-13-2013 06:52 AM
02-13-2013 06:56 AM
02-13-2013 06:59 AM
i need to add this button inside the Grid to list some values. So i need to change the back color.
Is there any way to change background color of items in the List or Grid