views:

499

answers:

1

I'm trying to add a Label to the LegendItem objects in my chart's legend, without much success. I extended the LegendItem class, and the constructor of the class I made is below. The problem is that the Label you see me trying to add doesn't appear in the legend item. It's there (I can find it with getChildByName), but it's invisible, for some reason.

Is there some special way to add objects to a custom legend item? Thanks.

public function LegendItemExtended() {
    super();
    someText = new Label();
    someText.name = "label";
    someText.text = "hi";
    addChild(someText);
}
+1  A: 

You have forgot to put the width and height :D, put this for ex:

someText.width = 200;
someText.height = 200;

and try to add your label in this function :

override protected function createChildren():void

I hope this could help.

ghalex
Thanks a lot, that worked. I assumed the width and height would default to something — now that I know they don't, I wonder how I've gone all this time without knowing. Thanks again.
kareem