2 Replies Latest reply on Mar 13, 2007 11:49 PM by avanthika

    How to Mask Image with different Shape

    avanthika Level 1
      Hi all,

      In my flex application , i am displaying a image which is in rectangle shape. but i want to show that image in a rounded rectangle shape, for that i want to mask the image with rounded rectangle, .
      anyone please tell me how to do this,
      i also tried by setting the mask property in the image, but i am not getting.

      please help me.

      thanks in advance

      regards
      avanthika
        • 1. Re: How to Mask Image with different Shape
          avanthika Level 1
          Hi all ,

          Still i didn't get any solution for this

          I am trying hard to solve this,
          anyone please help me, how to do this.

          Thanks in advance.

          regards
          avanthika
          • 2. Re: How to Mask Image with different Shape
            avanthika Level 1
            Hi all

            i am trying in this way still i did not get it

            i have placed image in a canvas.
            <mx:Canvas id="c1" x="10" y="10" width="200" height="200">
            <mx:Image id="img2" source="image1.jpg" />
            </mx:Canvas>

            to mask the above image , i need shape to mask i have written following code it is not working

            import flash.display.*;

            public function init(){
            var square:Sprite = new Sprite();
            square.graphics.beginFill(0xFF0000);
            square.graphics.drawRect(0, 0, 200, 200);
            c1.addChild(square);
            img2.mask=square;
            }

            please help me how to get this,
            Actually i don't know how to write code for drawing shapes in flex.

            Thanks in advance

            Regards
            Avanthika