0 Replies Latest reply on Oct 27, 2011 9:48 AM by dan201110

    applying a mask to a custom IconItemrenderer icon

    dan201110

      Hi,

       

      I've made a subclass of IconItemRenderer in order to change the label and icon positions. I've done it without problems but i want to apply a png mask to the icon. I´m doing it with this code:

       

      override protected function commitProperties():void

                          {

       

                                    super.commitProperties();

       

                                    [Embed(source="assets/circulo_personas160.png")]

                                    var imagenMascara:Class;

                                    var imgObj:Bitmap= new imagenMascara() as Bitmap;

        imgObj.bitmapData = imgObj.bitmapData.clone();

      iconDisplay.mask = imgObj as DisplayObject;

       

       

       

                          }

      and also I tried this:

      override protected function commitProperties():void

                          {

       

                                    super.commitProperties();

       

        var square:Sprite = new Sprite();

                                    square.graphics.beginFill(0xFF0000);

                                    square.graphics.drawRect(0, 0, 40, 40);

                                    addChild(square);

                                    iconDisplay.mask = square;

       

                          }

       

      The app always shows the image I'm assining to the mask propierty instead of the image assigned to the iconField with the mask applied. If I remove this code I can see the iconField Image. It means that all the rest runs fine.

       

      Wich could be the problem?

       

      Thanks in advance.