Solved

# Arc trajectory mc

Posted on 2004-11-03
279 Views
Hello there,
I have a mc that I need to move from point A to point B, I don't want it to move straight but to describe an arc trajectory.
I know one of the options is to have an empty mc with the onClipEvent(enterframe) checking if the point A = point B, and then if not, do the math to get it there. If possible, I'd like to stick to that, I just need the appropiate equations.

Cërf.
0
Question by:Cerf

LVL 27

Assisted Solution

this is a good script to start from.

speed=5;
xcenter=200;
ycenter=140;
angle=0;
}
onClipEvent(enterFrame){
angle += speed;
if (angle > 359)angle -= 360;
}

are you using flash mx?
0

LVL 8

Author Comment

yes,
should I start trying that already?
0

LVL 8

Author Comment

hmm, watching the script, I can see that it uses a center to do the arc.
from what I need to do, that center will change, how can I recalculate it?

Hold on, let me put together a little graphic to illustrate it better...
0

LVL 8

Author Comment

Ok,
http://es.geocities.com/cerfx/flash/ and look for Q_21193604.swf it is just an image (3kb)
0

LVL 8

Author Comment

now, what I want to accomplish is the following,
..[numbers in the image]..
first state [1],
on rollOver option1 [2],
on rollOut option1, return to the previous state, but if from rollover1 I move the mouse to option2 then [3]

is it too confusing?
0

LVL 11

Expert Comment

I don't want any points for this comment, but...

> that center will change, how can I recalculate it?

I've had a look at your graphic, and, to me, it looks like the mini circle option is rotating around a constant origin that is the centre of the bigger circle!  In what way is the centre changing?  If the bigger circle is moving left/right with the options too, you could simply adjust negatyve's xcenter variable in the onEnterFrame event

muso
0

LVL 8

Author Comment

hi,
Thanks for the input muso!
Actually, if you didvide the distance between the points by 2 and project a perpendicular line from that center you can change the center accurately, however, the problem I'm having now is that I need to figure out how can I express that movement in terms of XY instead of an angle.

negatyve, are you still there?

Cërf.
0

LVL 11

Accepted Solution

I have written a function previously here:
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21162904.html

coord takes an angle and a radius, and returns to an object with x and y distance - you adapt this to use it to calculate your x and y movement...

Just a thought!

muso
0

LVL 8

Author Comment

Hey there, sorry I have been out for a while,
I didn't implement any of the solutions since I was in a hurry, although I'm sure that working those out I'd get what I needed.

Thank you.

Cërf.
0

## Featured Post

### Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.