Moving an object along a curve with AS

hello guys, … i’m stuck and i need your help :angel:

i want to create a menu similar to The Infinite Menu (Link here), but with the difference that the menu will not run along a straight line, but along a curve (elipse).

I allready created a tween along a path, but it looks ugly when movement is slow, cuz of the limited frames :a:

any you guys have any ideas how to make this?

tnx, Shulchi

sup guys … did my homework :smiley:

here’s the result: YEY!!!

this was done using Prototypes Path(motion guide) class ( )

now i need some more help please! :smiley:

how can i attach more objects to this curve so that they will be appearing one after another with some space in between them.

I was thinking of a listener that triggers a attachMovie function to attach a new movie clip to the beggining of the curve.

But i don’t know how to tell that in Actionscript … please help :angel:

just make your objects and use an offset for t for each consectutive object that traverses the path.

… actually, come to think of it, Im going to edit that proto to allow t to wrap instead of chopping it off at 0 and 1 (so if you use 1.5 as t it will work as .5 and not 1)… maybe I should make that a parameter as well.

yey!!! worked nicely !!! :king:

thanks :sen: , your proto works miracles :smiley:

see the result on the same link

only thing puzzling me is how to stop the movement when the last “planet” :smiley: comes on stage. i tried several options including math.min and math.max, making t false, … but couldn’t fix it. :puzzle: Should i assign a new variable or function?? help me … Here’s the main AS code in my flash movie so far:


myPath = new Path(543, -110);
myPath.curveTo(625, -62, 659, 0);
myPath.curveTo(678, 34, 679, 73);
myPath.curveTo(670, 200, 524, 271);
myPath.curveTo(416, 325, 296, 348);
myPath.curveTo(182, 370, 76, 367);
myPath.curveTo(35, 367, 0, 365);
myPath.curveTo(-88, 359, -168, 340);

t = 0;

function mcSpeed() {
	var vAngle:Number;
	vAngle = Math.round(Math.atan(_ymouse/_xmouse)*180/Math.PI)-45;
	if (_xmouse<=0) {
		vAngle = 0;
	if (_ymouse<=0) {
		vAngle = 0;
var clipInterval:Number = setInterval(mcSpeed, 10);

this.onEnterFrame = function() {
	t += -(vAngle/45)
	myPath.traverse(this.mcOglas1, t*.04, false, false);
	myPath.traverse(this.mcOglas2, (t-5)*.04, false, false);
	myPath.traverse(this.mcOglas3, (t-10)*.04, false, false);
	myPath.traverse(this.mcOglas4, (t-15)*.04, false, false);
	myPath.traverse(this.mcOglas5, (t-20)*.04, false, false);
	myPath.traverse(this.mcOglas6, (t-25)*.04, false, false);
	myPath.traverse(this.mcOglas7, (t-30)*.04, false, false);

mcOglas1 thru 7 are the planets :D.
I want to make it so that, when the last planet comes to position, lets say y = 100, the movement stops in clockwise motion. The same for when the first planet goes offstage to a position of y= -80 that the movement stops in counterclockwise motion.

**** … i don’t know why it didn’t work before but now it works fiiiiiiiiiiine :smiley:

added some “if” statements