Give this a shot. Planet_mc is the movieclip to be rotated around,
satalite_mc is the one to orbit it.
var _angle:Number = 0;
var _radius:Number = 100;
var _rotationSpeed:Number = 5;
onEnterFrame = function () {
_angle += _rotationSpeed;
var xPos:Number =
(planet_mc_x+Math.cos((_angle*Math.PI)/180)*_radius);
var yPos:Number =
(planet_mc._y+Math.sin((_angle*Math.PI)/180)*_radius);
satalite_mc._x = xPos;
satalite_mc._y = yPos;
};
Daniel Holth
I.S. Programmer
x5217 || J401
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jay
Carlson
Sent: Wednesday, May 16, 2007 10:06 AM
To: [email protected]
Subject: [Flashcoders] rotating a movie clip around another movie
clip...
so I'm fairly new to using actionscript for everything in my
flash
and I was wondering if there was a way to rotate a movie clip around
another movie clip that is already rotating. here's the scenario...I
have a "crystal ball" that is floating in a circle thanks to
actionscript. this ball has 2 "light squares" on it to give the
impression of glass/lights/etc...I also have a separate shadow
movieclip on the ground below the ball that I am changing the size
and alpha according to the y position of the ball movieclip (via
actionscript, of course). I want to do the same thing with these
light squares. I'd like to give the effect of when the ball floats
down, the light squares rotate/move up on the ball and vise versa.
this would give the effect that this is just a glass ball floating in
space with overhead lights that are stationary. so that's what I
want to do and maybe it's way too far over my head for now, but I
guess I gotta learn somehow! so...is there a way to rotate/move this
light square movieclip according to the x & y axis of the ball
movieclip? any help would be appreciated...right now, I've been just
copying and pasting code in there and seeing what happens. I'm a
designer and not a math wiz, but I'm slowly learning. thanks!
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
This e-mail and its attachments are intended only for the use of the
addressee(s) and may contain privileged, confidential or proprietary
information. If you are not the intended recipient, or the employee or agent
responsible for delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution, displaying, copying, or
use of this information is strictly prohibited. If you have received this
communication in error, please inform the sender immediately and delete and
destroy any record of this message. Thank you.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com