Hi Friends ,
I want to rotate the image on center registration point but i am
unable do it. below i am sending code which i tried to implement image
rotation . please tell me any thing wrong i did in this code ?
public var aroundPoint:Point;
public function clickHandler():void
{
aroundPoint = resetCenterPoint(draggableImg, draggableImg.width/2,
draggableImg.height/2);
rotate(draggableImg, 90,aroundPoint.x, aroundPoint.y);
}
public function resetCenterPoint(obj:DisplayObject, orgX:Number,
orgY:Number):Point
{
var m:Matrix = obj.transform.matrix;
var orgXY:Point = m.deltaTransformPoint(new Point(orgX, orgX));
orgXY.x += m.tx;
orgXY.y += m.ty;
return orgXY;
}
public function rotate(obj:DisplayObject, angle:Number, aroundX:Number,
aroundY:Number):void
{
var m:Matrix = obj.transform.matrix;
//var orgXY:Point = resetCenterPoint(obj, obj.width/2, obj.height/2);
var cm:Matrix = new Matrix(1, 0, 0, 1, -aroundX, -aroundY);
m.concat(cm);
m.rotate(Math.PI * angle / 180);
var rcm:Matrix = new Matrix(1, 0, 0, 1, aroundX, aroundY);
m.concat(rcm);
obj.transform.matrix = m;
}
thanks in Advance
ramesh v
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.