For Scaling try this code:
private function scale(obj:DisplayObject):void {
var offsetWidth:Number = obj.contentWidth/2.0;
var offsetHeight:Number = obj.contentHeight/2.0;
var matrix:Matrix = new Matrix();
matrix.translate(-offsetWidth, -offsetHeight);
matrix.scale(1+0.02,1+0.02);
// matrix.scale(1-0.02,1-0.02); //this is for decrease
scale
// change to matrix.scale(1,-1) for vertical flip
matrix.translate(+offsetWidth, +offsetHeight);
matrix.concat(obj.transform.matrix);
obj.transform.matrix = matrix;
}
For Rotating try this:
private function rotate(obj:DisplayObject, degrees:Number):void {
// Calculate rotation and offsets
var radians:Number = degrees * (Math.PI / 180.0);
var offsetWidth:Number = obj.contentWidth/2.0;
var offsetHeight:Number = obj.contentHeight/2.0;
// Perform rotation
var matrix:Matrix = new Matrix();
matrix.translate(-offsetWidth, -offsetHeight);
matrix.rotate(radians);
matrix.translate(+offsetWidth, +offsetHeight);
matrix.concat(obj.transform.matrix);
obj.transform.matrix = matrix;
}
On Thu, Aug 11, 2011 at 4:48 PM, Abhinav Mehta <[email protected]>wrote:
> Hope this helps you.
> http://www.senocular.com/flash/tutorials/transformmatrix/
>
> --
> Abhinav Mehta
>
> On Aug 11, 2011, at 12:12 PM, சாமி. ஜெகன் லங்கா wrote:
>
> Hi,
>
> I Just want to do some translations (rotation scaling and re-position) on a
> DisplayObject about its center point as origin. When I googled, it says it
> is possible only with matrix class.
>
> Since I'm new to this domain, I feel its hard for me to make it.
>
> Is there any materials/blogs/tutorials/samples which helps me to learn
> about the matrix class and how to use it for my needs?
>
> Thanks In Advance.
> Jagan
>
> --
> Best Regards,
> S. Jagan Langa.
> Web App Developer
>
> -Sky is not the limit, Death is not the end, There is still something
> beyond....
>
>
> --
> 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.
>
>
> --
> 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.
>
--
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.