Wow. Sorry. I thought that might be helpful. Obviously it wasn't. I should
have given a more thorough answer - after all, this list is for more
advanced developers who don't need things simplified. There are 3 ways I
know of to do something like that (some have already been covered):

1) Wrap it in another DisplayObject/MovieClip, offset it however much you
need so that the new parent's registration point is where you need it on
your object. Then rotate the parent. Upside: it's easy. Down side: You're
screwing with the display list which fires off events like ADDED_TO_STAGE.
It feels like a hack.

2) Use matrix transformations like MatrixTransformer class's
rotateAroundInternalPoint() method. Cleaner in some ways, but in my
experience, it doesn't always give accurate results over time.

3) Determine where the point is internally around which you want to rotate
(according to your DisplayObject's local coordinates). Rotate and then use
localToGlobal() and globalToLocal() to figure out how much it was offset and
move the x/y coordinates to compensate.

Hope that was more helpful.

Jack

-----Original Message-----
From: Anthony Pace [mailto:anthony.p...@utoronto.ca] 
Sent: Monday, January 12, 2009 2:24 PM
To: Flash Coders List
Subject: Re: [Flashcoders] change the origin of rotation for a movieclip?

How about a real answer?

Jack Doyle wrote:
> There's a new plugin for TweenLite/Max that'll cause transformation
> (rotation/scale) tweens to occur around any point, so it'll be as easy as:
>
> TweenLite.to(mc, 2, {transformAroundPoint:{point:new Point(100, 100),
> rotation:85}});
>
> Or if you want to use the center of the object as its origin, you could
> simply do:
>
> TweenLite.to(mc, 2, {transformAroundCenter:{rotation:80}});
>
> It works for the scale too, like:
>
> TweenLite.to(mc, 2, {transformAroundCenter:{scaleX:1.5, scaleY:2,
> rotation:-70}});
>
> NOTE: The plugin is a membership benefit of Club GreenSock.
>
> You can see an interactive demo at http://blog.greensock.com/sneak-peek/
> (scroll all the way down in the list of plugins - they're at the bottom -
> click "example"). For those of you who are wondering "what's this 'plugin'
> talk with TweenLite - I didn't know there were any plugins!", it's a new
> feature that's part of a big update I'm rolling out soon. It adds lots of
> flexibility. Read more at the site.
>
> Jack
>
> PS There's also TransformMatrixProxy which has been around for a while and
> it'll do something similar and also let you skew things.
> http://blog.greensock.com/transformmatrixproxy/ It's not quite as
convenient
> as a plugin for TweenLite/Max, though.
>
>
> -----Original Message-----
> From: Anthony Pace [mailto:anthony.p...@utoronto.ca] 
> Sent: Saturday, January 10, 2009 6:12 PM
> To: Flash Coders List
> Subject: [Flashcoders] change the origin of rotation for a movieclip?
>
> How do you change the origin of rotation dynamically? can it be done?  
> or will it always be 0,0
>
> I was hoping that with the new features of as3 that this I would be able 
> to indicate where I wanted the origin; yet, I am starting to think that 
> I was hoping for too much.



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to