Question

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);
}
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top