0

Please help me to sort out a big issue .

I need to rotate a layout(spark component Group) from center , i am able to rotate it from center. but once i rotate it , its all gives me jadgy edges. Like if i rotate an image than i can set its bitmap smoothing to true , by which jadgy edges will not come. But in groups there is no smoothing variable Please tell me how can i achieve this.

var rotateMatrix:Matrix = group_icons.transform.matrix;
            var rotatePoint:Point =
                rotateMatrix.transformPoint(
                    new Point((515/2), (515/2)));
            rotateMatrix.translate(-rotatePoint.x, -rotatePoint.y);
            var num : Number = getAngleFromMouseCoord(mouseX , mouseY , new Point(0,600) ) ;
            /* if(currentAngle != 0 && currentAngle > num)
            {
                currentAngle = num ; 
                num = -num ; 
            }
            else
                currentAngle = num ; */
            if(direction == true  )
                rotateMatrix.rotate(num/30);
            else
                rotateMatrix.rotate(-num/30);
            rotateMatrix.translate(rotatePoint.x, rotatePoint.y);
            group_icons.transform.matrix = rotateMatrix ;

I am calling this function on ENTER_FRAME event.

Shashank Agarwal
  • 512
  • 3
  • 12

1 Answers1

0

See if setting cacheAsBitmap to true helps :

  group_icons.cacheAsBitmap = true;

If not you can always draw the group into a bitmap and display that but it's children won't be interactive.

 var bmdData:BitmapData = new BitmapData(group_icons.width,group_icons.height,true,0x0000000);
 bmdData.draw(group_icons);
 var bmp:Bitmap = new Bitmap(bmdData,"auto",true); 

 // apply transformations to the bmp here

 var uicomponent:UIComponent = new UIComponent();
 uiComponent.addChild(bmp);

 someUIElement.addElement(uicomponent);

You need to wrap a bitmap with a UIComponent to add it to a flex component.

Barış Uşaklı
  • 13,440
  • 7
  • 40
  • 66
  • Yeah i tried it.. But as you can see from my code .. I am getting matrix of group to rotate it. but if i will do this , i need to get matrix of this bitmap , by which i wont be able to set it on group & Group elements also not be intractable . – Shashank Agarwal Aug 22 '12 at 19:15