Maybe you want a SkinnableComponent with a label in its skin?
Thanks Alex, I will take a look at SkinnableComponent.
Alternatively, this also gives the desired result (except component needs to be re-measured....still trying to figure how to do that).
The objective was to extend a spark Label and make sure MyLabel always has a border and shading .......and few extra things specific to our needs (which I haven't added yet).
I've made use of the built in graphics.
public class MyLabel extends Label
private var dropShadow:RectangularDropShadow;
public function MyLabel()
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
var g:Graphics = graphics;
backgroundColor = getStyle("backgroundColor");
graphics.drawRoundRect(-5, -5, unscaledWidth+10, unscaledHeight+10, 10);
// Shadow......is their another way???
dropShadow = new RectangularDropShadow();
dropShadow.distance = 7;
dropShadow.angle = 45;
dropShadow.color = 0;
dropShadow.alpha = 0.4;
dropShadow.tlRadius = 5;
dropShadow.trRadius = 5; //cornerRadius;
dropShadow.blRadius = 5; //cornerRadius;
dropShadow.brRadius = 5;
dropShadow.drawShadow(graphics, 0, -5, unscaledWidth+5, unscaledHeight+10);
If I add a couple of these MyLabels into a HGroup (or VGroup) they look squashed. ......so I want to do a invalidateSize() or something