Frage

Follow the question last question

I can successfully create the class extended from CircleItemRenderer or any other ProgrammaticSkin ItemRenderers like below.

public class LSLabelCircleItemRenderer extends CircleItemRenderer
    {
        private var _label:Label;
        public function LSLabelCircleItemRenderer():void
        {
            super();
            _label = new Label();
        }
        override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            if(data != null){
                var ls:LineSeries = ChartItem(data).element as LineSeries;
                label.text = LineSeriesItem(data).yValue.toString();
                skin.parent.addChild(label);
                label.setStyle("color",ls.getStyle("fill"));
                label.move(skin.x - label.getExplicitOrMeasuredWidth() / 5,skin.y - label.getExplicitOrMeasuredHeight());
            }
        }       
    }

Now I found I find no where to do the same thing embedded-image ItemRenderer which in mxml is like below

itemRenderer="@Embed(source='../assets/butterfly.gif')" 

How do I add my custome label with this kind of ItemRenderer?

Thanks!

War es hilfreich?

Lösung

Similar how you did the previous itemRenderer, you can add the embedded image to the extended itemRenderer

[Embed(source="../assets/butterfly.gif")][Bindable] public var butterflyClass:Class;

var image:Image = new Image();
image.source =  butterflyClass;

See also: Using the [Embed] metadata tag

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top