1 Reply Latest reply on Sep 5, 2012 2:44 AM by Vikram_S

    Delete canvas drew rectangle by clicking

    M.Kang

      Hi All,

       

      I have manage to draw some rectangle in my canvas.

       

      Is it possible for me to delete them by either clicking on the rectangle or put a X button on the rectangle to delete it ?

       

      For example : I drew 3 rectangle(A,B,C) and I wanted to delete rectangle B. Is it possible for me to delete rectangle B by clicking on it ?

       

      Anyone have any idea regarding this ?

       

      Regards,

      Mike

        • 1. Re: Delete canvas drew rectangle by clicking
          Vikram_S Level 2

          Hi Mike,

           

               Possible , but It depends on how you draw those rectangles. If I have to write then I will write in following way,

          I will draw each rectangle on different sprite. Add these sprite to UIComponent and then this UIComponent will go as child of Canvas. Now while adding  sprite to UIComponent add mouse click event listner to sprite. In this event list you can remove it from its parent.

           

          Hope this will help you....