0 Replies Latest reply on Dec 5, 2010 10:29 AM by srini_7206

    How to remove spritevisualelement from group

    srini_7206

      Hi,

      I have drawn triangles using spritevisualelement and added that to Group.But when I try to remove the previously plotted elements using array ,those are not atually removed from the group instead the triangles are still visible.How to make them to be deleted from the Group.So that I can draw new triangles without overlapping.

       

      var tempArr:Array=[];

      function drawTriangles():void{

       

      for each(var item:SpriteVisualElement in tempArr){

       

           if(grpChart.contains(item)){

                     grpChart.removeElement(item);

           }

      }

      var sprite:SpriteVisualElement=new SpriteVisualElement();

       

      sprite.graphics.clear();

      sprite.graphics.lineStyle();

      sprite.graphics.beginFill();

      sprite.graphics.moveTo();

      sprite.graphics.lineTo();

      sprite.graphics.lineTo();

      sprite.graphics.moveTo();

      sprite.graphics.endFill();

       

      grpChart.addElement(sprite);//grpChart is Group

      tempAr.push(sprite);

       

      }